Mapbox-navigation-android: IllegalArgumentException when simulating a route

Created on 9 Aug 2019  ยท  13Comments  ยท  Source: mapbox/mapbox-navigation-android

Hi Mapbox team, I'm having a strange bug using theNavigationView, I generate a route then pass the route to the NavigationViewOptions.Builder and displays it on the NavigationView, everything works fine until I set the shouldSimulateRoute to true for the builder. It crashes every time with the following error:

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: pro.mobile4.vision, PID: 20109
    java.lang.IllegalArgumentException: Non-null and non-empty location list required.
        at com.mapbox.services.android.navigation.v5.location.replay.ReplayLocationDispatcher.checkValidInput(ReplayLocationDispatcher.java:79)
        at com.mapbox.services.android.navigation.v5.location.replay.ReplayLocationDispatcher.<init>(ReplayLocationDispatcher.java:22)
        at com.mapbox.services.android.navigation.v5.location.replay.ReplayRouteLocationEngine.obtainDispatcher(ReplayRouteLocationEngine.java:164)
        at com.mapbox.services.android.navigation.v5.location.replay.ReplayRouteLocationEngine.start(ReplayRouteLocationEngine.java:154)
        at com.mapbox.services.android.navigation.v5.location.replay.ReplayRouteLocationEngine.beginReplayWith(ReplayRouteLocationEngine.java:203)
        at com.mapbox.services.android.navigation.v5.location.replay.ReplayRouteLocationEngine.requestLocationUpdates(ReplayRouteLocationEngine.java:113)
        at com.mapbox.services.android.navigation.v5.navigation.LocationUpdater.requestInitialLocationUpdates(LocationUpdater.java:58)
        at com.mapbox.services.android.navigation.v5.navigation.LocationUpdater.<init>(LocationUpdater.java:31)
        at com.mapbox.services.android.navigation.v5.navigation.NavigationService.initializeLocationUpdater(NavigationService.java:124)
        at com.mapbox.services.android.navigation.v5.navigation.NavigationService.initialize(NavigationService.java:95)
        at com.mapbox.services.android.navigation.v5.navigation.NavigationService.startNavigation(NavigationService.java:66)
        at com.mapbox.services.android.navigation.v5.navigation.MapboxNavigation.onServiceConnected(MapboxNavigation.java:810)
        at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:1848)
        at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1880)
        at android.os.Handler.handleCallback(Handler.java:873)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:214)
        at android.app.ActivityThread.main(ActivityThread.java:7073)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:964)

My code to start the navigation is as follow:

private fun startNavigation() {
        val options = NavigationViewOptions.builder()
            .directionsRoute(directionsRoute)
            .navigationListener(this@NavigationFragment)
            .progressChangeListener(this@NavigationFragment)
            .shouldSimulateRoute(true)
            .build()

        navigationView.startNavigation(options)
        navigationView.findViewById<View>(R.id.feedbackFab).visibility = View.GONE
        navigationView.findViewById<View>(R.id.alertView).visibility = View.GONE
    }

When I debug a little bit I found that the ReplayRoute gets an empty array of points even though the navigation has all the necessary point.

I tried passing the route to the ReplayRouteLocationEngine and then pass the engine to the builder but still getting the same issue.

Android API: 28
Mapbox Navigation SDK version: 0.41.0

bug

Most helpful comment

In my case, Origin lat-long and destination lat-long are same.

I have observed that when there have no maneuver, it causes an error.

All 13 comments

@113408 Hi, I've been struggling with the same issue for a while now. Did you tested the app without shouldSimulateRoute ?

I managed to make it work by using a route without waypoints (just a start
and finish point) not very convenient but didn't have time to dig deeper

On Thu, Aug 29, 2019, 11:50 AM Pedro Cerejo notifications@github.com
wrote:

@113408 https://github.com/113408 Hi, I've been struggling with the
same issue for a while now. Did you tested the app without
shouldSimulateRoute ?

โ€”
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/mapbox/mapbox-navigation-android/issues/2019?email_source=notifications&email_token=ADIOOAJX372TX4H337KIJL3QG6LWVA5CNFSM4IKTFZLKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5N5Q2A#issuecomment-526112872,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ADIOOAKV3WOGLQNXKEOQZNDQG6LWVANCNFSM4IKTFZLA
.

Happened to me also ! :( Does anyone have a fix for this ?

In my case, this problem occurred because one of the waypoints had invalid coordinates.

In my case, Origin lat-long and destination lat-long are same.

I have observed that when there have no maneuver, it causes an error.

I'm hoping this pr #2066 solves it

let's wait for official update from @Guardiola31337 or @andrlee

I got same error when the origin and destination have the same coordinates. Is there any news?

I got same error when the origin and destination have the same coordinates. Is there any news?

@InesRodriguezAlonso No, i didn't get any news from Mapbox for this issues in android app.

We don't have such issue in iPhone. Only Android app with Mapbox is crashing for such scenario.

Hey ๐Ÿ‘‹ @113408 @schimini @AlexStroia @jkpatel1463 @InesRodriguezAlonso thanks for checking out the SDK.

Closing here in favor of https://github.com/mapbox/mapbox-navigation-android/issues/3013

In any case, ReplayRouteLocationEngine is going to be deprecated and replaced by ReplayLocationEngine ๐Ÿ‘€ https://github.com/mapbox/mapbox-navigation-android/pull/300 which will be available in the upcoming 1.0 public beta release ๐Ÿš€ Stay tuned!

cc @kmadsen

Hey @113408 @schimini @AlexStroia @jkpatel1463 @InesRodriguezAlonso we've just released release_core_1.0.0-rc.1 ๐ŸŽ‰ ๐Ÿš€

Please review the developer documentation to start building with the Mapbox core Navigation SDK v1.0 for Android and if you already use an older version of the Navigation SDK, check out the migration guide to transition your project from the "legacy" core Navigation SDK to the 1.0 version and let us know if you have any questions or run into issues and please open tickets in https://github.com/mapbox/mapbox-navigation-android/issues/new and we will take it from there! We would love your feedback.

Thanks again!

@Guardiola31337 Still getting this crash in new latest versions
I am using navigation view 'com.mapbox.mapboxsdk:mapbox-android-navigation-ui:0.42.6'

Process: com.flashmarket.delivery, PID: 2437
    java.lang.IllegalArgumentException: Non-null and non-empty location list required.
        at com.mapbox.services.android.navigation.v5.location.replay.ReplayLocationDispatcher.checkValidInput(ReplayLocationDispatcher.java:79)
        at com.mapbox.services.android.navigation.v5.location.replay.ReplayLocationDispatcher.<init>(ReplayLocationDispatcher.java:22)
        at com.mapbox.services.android.navigation.v5.location.replay.ReplayRouteLocationEngine.obtainDispatcher(ReplayRouteLocationEngine.java:164)
        at com.mapbox.services.android.navigation.v5.location.replay.ReplayRouteLocationEngine.start(ReplayRouteLocationEngine.java:154)
        at com.mapbox.services.android.navigation.v5.location.replay.ReplayRouteLocationEngine.beginReplayWith(ReplayRouteLocationEngine.java:203)
        at com.mapbox.services.android.navigation.v5.location.replay.ReplayRouteLocationEngine.requestLocationUpdates(ReplayRouteLocationEngine.java:113)
        at com.mapbox.services.android.navigation.v5.navigation.LocationUpdater.requestInitialLocationUpdates(LocationUpdater.java:58)
        at com.mapbox.services.android.navigation.v5.navigation.LocationUpdater.<init>(LocationUpdater.java:31)
        at com.mapbox.services.android.navigation.v5.navigation.NavigationService.initializeLocationUpdater(NavigationService.java:124)
        at com.mapbox.services.android.navigation.v5.navigation.NavigationService.initialize(NavigationService.java:95)
        at com.mapbox.services.android.navigation.v5.navigation.NavigationService.startNavigation(NavigationService.java:66)
        at com.mapbox.services.android.navigation.v5.navigation.MapboxNavigation.onServiceConnected(MapboxNavigation.java:813)
        at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:2037)
        at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:2069)
        at android.os.Handler.handleCallback(Handler.java:888)
        at android.os.Handler.dispatchMessage(Handler.java:100)
        at android.os.Looper.loop(Looper.java:213)
        at android.app.ActivityThread.main(ActivityThread.java:8178)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1101)

@vidhi1011 the ReplayRouteLocationEngine is deprecated. Are you able to migrate to the new MapboxReplayer and ReplayLocationEngine?

https://github.com/mapbox/mapbox-navigation-android/issues/2019#issuecomment-638465362

Was this page helpful?
0 / 5 - 0 ratings

Related issues

carstenhag picture carstenhag  ยท  5Comments

diegolaballos picture diegolaballos  ยท  4Comments

jethromay picture jethromay  ยท  7Comments

trinhvanminh2009 picture trinhvanminh2009  ยท  5Comments

Guardiola31337 picture Guardiola31337  ยท  5Comments