mapbox-navigation-android icon indicating copy to clipboard operation
mapbox-navigation-android copied to clipboard

Crash when getting route NavigationMapRoute

Open deleonAndroid3 opened this issue 9 years ago • 20 comments

java.lang.NoSuchMethodError: No static method lineWidth(Lcom/mapbox/mapboxsdk/style/functions/CameraFunction;)Lcom/mapbox/mapboxsdk/style/layers/PropertyValue; in class Lcom/mapbox/mapboxsdk/style/layers/PropertyFactory; or its super classes (declaration of 'com.mapbox.mapboxsdk.style.layers.PropertyFactory' appears in /data/app/com.training.android.undivided-1/split_lib_dependencies_apk.apk:classes49.dex)
                                                                                    at com.mapbox.services.android.navigation.ui.v5.route.NavigationMapRoute.addNavigationRouteLayer(NavigationMapRoute.java:371)
                                                                                    at com.mapbox.services.android.navigation.ui.v5.route.NavigationMapRoute.initialize(NavigationMapRoute.java:179)
                                                                                    at com.mapbox.services.android.navigation.ui.v5.route.NavigationMapRoute.<init>(NavigationMapRoute.java:156)
                                                                                    at com.mapbox.services.android.navigation.ui.v5.route.NavigationMapRoute.<init>(NavigationMapRoute.java:135)
                                                                                    at com.mapbox.services.android.navigation.ui.v5.route.NavigationMapRoute.<init>(NavigationMapRoute.java:80)
                                                                                    at com.training.android.undivided.NavigationMode.NavigationMode.initMapRoute(NavigationMode.java:219)
                                                                                    at com.training.android.undivided.NavigationMode.NavigationMode.onResponse(NavigationMode.java:185)
                                                                                    at retrofit2.ExecutorCallAdapterFactory$ExecutorCallbackCall$1$1.run(ExecutorCallAdapterFactory.java:68)
                                                                                    at android.os.Handler.handleCallback(Handler.java:739)
                                                                                    at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                                    at android.os.Looper.loop(Looper.java:135)
                                                                                    at android.app.ActivityThread.main(ActivityThread.java:5235)
                                                                                    at java.lang.reflect.Method.invoke(Native Method)
                                                                                    at java.lang.reflect.Method.invoke(Method.java:372)
                                                                                    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:898)
                                                                                    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:693)

This error points to this line mapRoute = new NavigationMapRoute(mapView, mapboxMap);

deleonAndroid3 avatar Oct 11 '17 18:10 deleonAndroid3

Having the exact same issue. Any fixes?

nimesha95 avatar Oct 17 '17 09:10 nimesha95

Same issue here. Wish someone from Mapbox can give an answer!

josephquzhou avatar Oct 26 '17 14:10 josephquzhou

@nimesha95 @josephquzhou @deleonAndroid3 could you add which version of the maps sdk you are using? A no such method error indicates that you are overriding the maps sdk used for the navigation SDK with a newer version that has a different signature in methods as the nav sdk. We are currently trying to bring the 5.2.0 maps sdk to the nav sdk.

tobrun avatar Oct 26 '17 16:10 tobrun

mapbox-android-sdk:5.2.0-beta.2@aar mapbox-android-navigation:0.6.2 mapbox-android-navigation-ui:0.6.2

josephquzhou avatar Oct 26 '17 16:10 josephquzhou

@josephquzhou for now you will have to downgrade to 5.1.4 for it to work. We will update this ticket once we have updated the internal dependency to a 5.2.0 version.

cc @danesfeder

tobrun avatar Oct 26 '17 16:10 tobrun

@tobrun Thanks! It is working!

josephquzhou avatar Oct 26 '17 16:10 josephquzhou

@tobrun and @josephquzhou : I am facing the same issue. and when i moved mapbox map sdk to 5.1.4, my activity is nolonger able to started.

can you please share if i missed anything?

i change my gradle to

compile('com.mapbox.mapboxsdk:mapbox-android-sdk:5.1.4@aar') {
        transitive=true
 }
compile 'com.mapbox.mapboxsdk:mapbox-android-navigation:0.6.3'

compile ('com.mapbox.mapboxsdk:mapbox-android-navigation-ui:0.6.3') {
        transitive = true
}

thanks, Hoang

hoangphan avatar Oct 28 '17 07:10 hoangphan

@hoangphan try the following, mapbox-android-sdk:5.1.4 mapbox-android-navigation:0.6.2 mapbox-android-navigation-ui:0.6.2

josephquzhou avatar Oct 28 '17 15:10 josephquzhou

@josephquzhou thanks for the response. i tried this before, but with no success :)

anyway, i am a little bit curious why a navigation crash issue would have link to the sdk version of a map? aren't they separated?

hoangphan avatar Oct 28 '17 16:10 hoangphan

@josephquzhou @tobrun : update: only with 5.1.4 and 0.6.0 snapshot the NavigationLauncher.startNavigation is working. but still occasionally crashes :)

hoangphan avatar Oct 30 '17 02:10 hoangphan

@hoangphan @nimesha95 @josephquzhou @deleonAndroid3 We released a new version of the nav sdk 0.6.3 that is compatible with the 5.2.0-beta.3 version of the map sdk. We hope that you test out this version and please provide any feedback you have on this version. I'm closing this issue as this one is resolved. Thank you all for using Mapbox.

tobrun avatar Oct 30 '17 14:10 tobrun

@tobrun - I am trying the above-mentioned config for testing [5.2.0-beta.3 and 0.6.3] but app is still crashing. Below is the crash log

java.lang.NoSuchMethodError: No static method lineWidth(Lcom/mapbox/mapboxsdk/style/functions/CameraFunction;)Lcom/mapbox/mapboxsdk/style/layers/PropertyValue; in class Lcom/mapbox/mapboxsdk/style/layers/PropertyFactory; or its super classes (declaration of 'com.mapbox.mapboxsdk.style.layers.PropertyFactory' appears in /data/app/navigation.sample.com.mapboxsdktest-2/split_lib_dependencies_apk.apk) at com.mapbox.services.android.navigation.ui.v5.route.NavigationMapRoute.addNavigationRouteLayer(NavigationMapRoute.java:374) at com.mapbox.services.android.navigation.ui.v5.route.NavigationMapRoute.initialize(NavigationMapRoute.java:179) at com.mapbox.services.android.navigation.ui.v5.route.NavigationMapRoute.<init>(NavigationMapRoute.java:156) at com.mapbox.services.android.navigation.ui.v5.route.NavigationMapRoute.<init>(NavigationMapRoute.java:135) at navigation.sample.com.mapboxsdktest.NavigationTestActivity$2.onResponse(NavigationTestActivity.java:163) at retrofit2.ExecutorCallAdapterFactory$ExecutorCallbackCall$1$1.run(ExecutorCallAdapterFactory.java:68) at android.os.Handler.handleCallback(Handler.java:822) at android.os.Handler.dispatchMessage(Handler.java:104) at android.os.Looper.loop(Looper.java:207) at android.app.ActivityThread.main(ActivityThread.java:5811) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:681)

To reproduce this crash, please use the MainActivity given under Final Product section via Building a navigation app for android tutorial

muditagarwal avatar Nov 03 '17 09:11 muditagarwal

we recently identified that the location layer plugin hasn't been updated, this is resulting in a dependency mismatch and thus api mismatch. To unblock further development, you need to use the snapshot versions of all dependencies. We are working on releasing stable versions of these. Let us know if you run into any more issues!

tobrun avatar Nov 03 '17 10:11 tobrun

@tobrun Please can you advise the exact snapshot versions to use?

Thanks for your time, James

csjames avatar Nov 06 '17 18:11 csjames

@csjames : i'm using 0.6.0 snapshot + 5.1.4 and it seems fine.

hoangphan avatar Nov 07 '17 16:11 hoangphan

@hoangphan - Can you please post exact gradle dependency versions. My code is not compiling at all while using 0.6.0 snapshot and 5.1.4

Gradle: compile('com.mapbox.mapboxsdk:mapbox-android-sdk:5.1.4@aar') { transitive = true } compile 'com.mapbox.mapboxsdk:mapbox-android-navigation:0.6.0-SNAPSHOT' compile 'com.mapbox.mapboxsdk:mapbox-android-navigation-ui:0.6.0-SNAPSHOT'

Getting following error: `FAILURE: Build failed with an exception. What went wrong: Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.

com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex`

muditagarwal avatar Nov 08 '17 04:11 muditagarwal

@hoangphan @tobrun Can confirm I am getting the same error as @muditagarwal when using those versions

csjames avatar Nov 08 '17 16:11 csjames

@muditagarwal @csjames

compile('com.mapbox.mapboxsdk:mapbox-android-sdk:5.1.4@aar') { transitive=true } compile 'com.mapbox.mapboxsdk:mapbox-android-navigation:0.6.3' compile ('com.mapbox.mapboxsdk:mapbox-android-navigation-ui:0.6.1') { exclude group: 'android.arch.core' transitive = true }

Works for me. You need to add the exclude group as above to get rid of the

com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex`

rheng001 avatar Nov 09 '17 04:11 rheng001

@rheng001 - thanks so much! android studio 3.0 was giving build errors with the above so here is the fixed version, in case someone needs it.

compile ('com.mapbox.mapboxsdk:mapbox-android-sdk:5.1.4@aar') {
        transitive = true
    }
    compile 'com.mapbox.mapboxsdk:mapbox-android-navigation:0.6.3'
    compile ('com.mapbox.mapboxsdk:mapbox-android-navigation-ui:0.6.1') {
        exclude group: 'android.arch.core'
        transitive = true
    }

It is exactly same as above in terms of versions, I just added a line space between exclude group and transitive.

muditagarwal avatar Nov 09 '17 09:11 muditagarwal

Thank you all for chiming in on working configurations! We are planning to release new versions of the library that will not require you to exclude anything.

tobrun avatar Nov 09 '17 10:11 tobrun