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

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

Open carstenhag opened this issue 5 years ago • 12 comments

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

carstenhag avatar Sep 17 '20 11:09 carstenhag

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.

stale[bot] avatar Dec 19 '20 08:12 stale[bot]

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

carstenhag avatar Dec 19 '20 08:12 carstenhag

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

Guardiola31337 avatar Dec 21 '20 17:12 Guardiola31337

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 avatar Dec 22 '20 12:12 carstenhag

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

carstenhag avatar Dec 22 '20 12:12 carstenhag

@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.

mskurydin avatar Dec 22 '20 15:12 mskurydin

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)

carstenhag avatar Dec 22 '20 15:12 carstenhag

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

Jackyaung avatar Apr 06 '21 09:04 Jackyaung

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.

stale[bot] avatar Jul 21 '21 04:07 stale[bot]

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

peterszaszlateral avatar Aug 16 '21 09:08 peterszaszlateral

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

  • The sdk tries to navigate to a place, but there's no internet and offline maps also haven't been downloaded.
    Now, to the solutions:
    • Either make sure to previously check if the device has internet connectivity.
    • or handle this error by implementing the onRoutesRequestFailure callback. That way, if this error occurs, you can show a message to the user to connect to the internet or that they need to download a bigger offline map.

carstenhag avatar Aug 16 '21 19:08 carstenhag

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

mochadwi avatar Aug 09 '24 19:08 mochadwi