Bug: Offline navigation fails due to "no suitable edges near location" for no apparent reason
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
- Start a navigation from Location A to Location B without having an internet connection (Will try to provide locations later!)
- MapboxOnboardRouter errors about "no suitable edges near location".
- 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
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.
Still able to Reproduce the same thing with 1.1.0 core and ui
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
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
)
Currently the app just loads and loads (but it never completes/aborts). Maybe we need to override onRoutesRequestFailure, I just saw that callback?

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

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

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.
com.mapbox.navigation:ui:1.5.0 still having this issue. how to fix it ?
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.
for me, using applyDefaultParams() in the RouteOptions.builder() works, and only override the relevant properties, e.g: profile, coordinates & accessToken