mapbox / mapbox-navigation-android

Mapbox Navigation SDK for Android
https://docs.mapbox.com/android/navigation/overview/
Other
621 stars 318 forks source link

Bug: Offline navigation fails due to "no suitable edges near location" for no apparent reason #3575

Open carstenhag opened 3 years ago

carstenhag commented 3 years ago

Android API: OnePlus 5 and Samsung A70 with Android 10 Mapbox Navigation SDK version:

  implementation 'com.mapbox.navigation:ui:1.0.0-rc.7'
  implementation 'com.mapbox.navigation:core:1.1.0-alpha.4'

Using version 1.1.0-alpha.4 due to #3554. Can't test previous versions as it crashes there instantly.

Steps to trigger behavior

  1. Start a navigation from Location A to Location B without having an internet connection (Will try to provide locations later!)
  2. MapboxOnboardRouter errors about "no suitable edges near location".
  3. Nothing happens. Maybe we are missing an observer or we don't handle something right
2020-09-17 11:47:09.520 2268-3913/com.redacted.integ E/MapboxLogger: Unable to resolve host "api.mapbox.com": No address associated with hostname
2020-09-17 11:47:09.652 2268-3637/com.redacted.integ E/Mbgl: {s.routing.integ}[JNI]: Error setting property: line-color Expected at least 3 arguments, but found only 1.
2020-09-17 11:47:09.652 2268-3637/com.redacted.integ E/Mbgl: {s.routing.integ}[JNI]: Error setting property: line-color Expected at least 3 arguments, but found only 1.
2020-09-17 11:47:11.126 2268-2268/com.redacted.integ E/MapboxOnboardRouter: Error occurred fetching offline route: No suitable edges near location - Code: 171

Expected behavior

Navigation does not fail OR we can subscribe to an error somewhere

Actual behavior

Navigation fails, no clue how to safeguard this

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

carstenhag commented 3 years ago

Still able to Reproduce the same thing with 1.1.0 core and ui

Guardiola31337 commented 3 years ago

Hey @carstenhag 👋

Could you share your request setup / RouteOptions you're adding and the DirectionsRoute that you get / use when you have a chance?

cc @mskurydin @SiarheiFedartsou @etl

carstenhag commented 3 years ago

Sure, here's the info I have :). I can only give you the routeOptions, we don't get any DirectionsRoute back at the routesRequestCallback. Gson().toJson(routeOptions):

{
   "accessToken":"pk.eyXXXXXXX.TXXXXXXX",
   "bannerInstructions":true,
   "baseUrl":"https://api.mapbox.com",
   "coordinates":[
      {
         "coordinates":[
            0.1074297,
            38.8397132
         ],
         "type":"Point"
      },
      {
         "coordinates":[
            10.029649,
            48.456818
         ],
         "type":"Point"
      },
      {
         "coordinates":[
            9.210879000000002,
            49.1426929
         ],
         "type":"Point"
      }
   ],
   "geometries":"polyline6",
   "language":"de_DE",
   "profile":"driving-traffic",
   "requestUuid":"",
   "steps":true,
   "user":"mapbox",
   "voiceInstructions":true
}
2020-12-22 12:57:16.876 com.package.name E/MapboxOnboardRouter: Error occurred fetching offline route: No suitable edges near location - Code: 171
            val routeoptions = RouteOptions.builder()
                    .applyDefaultParams()
                    .accessToken(mapboxApiToken)
                    .coordinates(coordinates)
                    .steps(true)
                    .voiceInstructions(true)
                    .bannerInstructions(true)
                    .language(deviceLanguage)
                    .profile(DirectionsCriteria.PROFILE_DRIVING_TRAFFIC)
                    .build()
            currentMapboxNavigation?.requestRoutes(
                routeoptions,
                routesRequestCallback
            )
carstenhag commented 3 years ago

Currently the app just loads and loads (but it never completes/aborts). Maybe we need to override onRoutesRequestFailure, I just saw that callback?

Bildschirmfoto 2020-12-22 um 13 00 57
mskurydin commented 3 years ago

@carstenhag Hey! This is a fairly long route and requires a good piece of the routing graph.

image

We currently maintain a small ambient cache of routing tiles in the area of driving and support the off-line routing in this area. We are working on a broader solution for pre-caching arbitrary areas on-board.

carstenhag commented 3 years ago

Agree, I think this includes my current location (I'm on vacation), but it also applied when I was still at home (Near Mering).

But as far as I understand, this is caused by there not being offline data cached and the device being offline. Then it was just a misunderstanding from my side, maybe the error message could be improved to hint how to handle that case? (eg, mention onRoutesRequestFailure, in retrospect I feel dumb not having tried using it before)

Jackyaung commented 3 years ago

any solutions? I am having the same problem now, I have been stucking here for a few days already.

I use com.mapbox.navigation:core:1.5.0' and com.mapbox.navigation:ui:1.5.0'

And I don't know why .applyDefaultParams() is showing red in my code and also I keep getting this error too: com.mapbox.navigation.utils.NavigationException: Error occurred fetching offline route: No suitable edges near location - Code: 171

image

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

peterszaszlateral commented 3 years ago

com.mapbox.navigation:ui:1.5.0 still having this issue. how to fix it ?

carstenhag commented 3 years ago

As I commented at https://github.com/mapbox/mapbox-navigation-android/issues/3575#issuecomment-749616635, pretty sure the issue/solution is:

mochadwi commented 1 month ago

for me, using applyDefaultParams() in the RouteOptions.builder() works, and only override the relevant properties, e.g: profile, coordinates & accessToken