Implementing Android SDK for maps in android auto

54 Views Asked by At

currently I'm using this version of dependency:

implementation ("com.google.android.libraries.navigation:navigation:5.2.0")

And when I try to draw the map

public final SurfaceCallback mSurfaceCallback =
        new SurfaceCallback() {
            @Override
            public void onSurfaceAvailable(@NonNull SurfaceContainer surfaceContainer) {

                if (!isSurfaceReady(surfaceContainer)) {
                    return;
                }

                VirtualDisplay virtualDisplay =
                                    mCarContext
                                .getSystemService(DisplayManager.class)
                                .createVirtualDisplay(
                                        "nameVD",
                                        surfaceContainer.getWidth(),
                                        surfaceContainer.getHeight(),
                                        surfaceContainer.getDpi(),
                                        surfaceContainer.getSurface(),
                                        DisplayManager.VIRTUAL_DISPLAY_FLAG_OWN_CONTENT_ONLY);
                Presentation presentation = new Presentation(mCarContext, virtualDisplay.getDisplay());

                NavigationViewForAuto navigationView = new NavigationViewForAuto(mCarContext);
                navigationView.onCreate(null);
                navigationView.onStart();
                navigationView.onResume();

                presentation.setContentView(navigationView);
                presentation.show();

                navigationView.getMapAsync(googleMap -> mBackgroundMap = googleMap);
            } 
}

I get some error related some Method cant be find from CronetEngine

Process: com.example.androidautopoc, PID: 20319 java.lang.NoSuchMethodError: No virtual method getEffectiveConnectionType()I in class Lorg/chromium/net/CronetEngine; or its super classes (declaration of 'org.chromium.net.CronetEngine' appears in /data/app/~~J89DPULdY2pZZeIIAM5huA==/com.example.androidautopoc-0RXh7vNZHF7G_b8D5_saJA==/base.apk!classes7.dex)

or maybe i need another way to implement the map

0

There are 0 best solutions below