Crash when starting navigation:
Fatal Exception: java.lang.Error: Any tile edge can only be used once as part of the geometry
at com.mapbox.navigator.Navigator.getRouteBufferGeoJson(Navigator.java)
at com.mapbox.services.android.navigation.v5.navigation.MapboxNavigator.retrieveRouteGeometryWithBuffer(MapboxNavigator.java:99)
at com.mapbox.services.android.navigation.v5.navigation.NavigationRouteProcessor.updateRoute(NavigationRouteProcessor.java:64)
at com.mapbox.services.android.navigation.v5.navigation.NavigationRouteProcessor.buildNewRouteProgress(NavigationRouteProcessor.java:43)
at com.mapbox.services.android.navigation.v5.navigation.RouteProcessorRunnable.process(RouteProcessorRunnable.java:63)
at com.mapbox.services.android.navigation.v5.navigation.RouteProcessorRunnable.run(RouteProcessorRunnable.java:46)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:226)
at android.os.HandlerThread.run(HandlerThread.java:65)
Android API: Android 9
*Mapbox Navigation SDK version:0.42*
Not sure how to reproduce the crash. The only information I have is that it happens when starting navigation.
We should check if this could be an issue in 1.0 @mapbox/navigation-android
BTW does that ring a 馃敂 @kevinkreiser @mskurydin?
Any ideas @mskurydin @SiarheiFedartsou?
Hey @diegolaballos is this still an issue for you when using 1.0?
We're currently migrating to 1.0 so still not sure. I'd open another ticket if it happens again there
@diegolaballos That makes sense 馃憤
Good to close here then?
Friendly reminder that you can review the developer documentation to start building with the Mapbox Navigation SDK v1.0 for Android and check out the migration guide to transition your project from the "legacy" Navigation SDK to the 1.0 version and let us know if you have any questions or run into issues. We would love your feedback.
We've heard of another customer integrating v1.0 hitting this issue. Reopening to prioritize an investigation.
blocked on this same issue too
implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:9.5.0'
implementation 'com.mapbox.mapboxsdk:mapbox-sdk-services:5.6.0'
implementation 'com.mapbox.navigation:ui:1.1.0'
Crashes on route.addRoute(routes.first))
fun configureMapView(activity: Activity, mapView: MapView, places: List<Place>, lifecycleOwner: LifecycleOwner) {
val latLngs = places.mapNotNull {
it.lat?.let { lat ->
it.lng?.let { lng ->
LatLng(it.lat, it.lng)
}
}
}
val points = latLngs.map {
Point.fromLngLat(it.latitude, it.longitude)
}
mapView.getMapAsync { map ->
map.setStyle(Style.MAPBOX_STREETS)
val navigationOptions = MapboxNavigation
.defaultNavigationOptionsBuilder(activity, MAPBOX_ACCESS_TOKEN)
.build()
val mapboxNavigation = MapboxNavigationProvider.create(navigationOptions)
mapboxNavigation.requestRoutes(
RouteOptions.builder()
.applyDefaultParams()
.accessToken(MAPBOX_ACCESS_TOKEN)
.coordinates(points)
.profile(RouteUrl.PROFILE_WALKING)
.build(),
object : RoutesRequestCallback {
override fun onRoutesReady(routes: List<DirectionsRoute>) {
val route = NavigationMapRoute.Builder(mapView, map, lifecycleOwner)
.withBelowLayer(null)
.withMapboxNavigation(null)
.withVanishRouteLineEnabled(false)
.withStyle(R.style.MapboxStyleNavigationMapRoute)
.build()
route.addRoute(routes.first())
}
override fun onRoutesRequestCanceled(routeOptions: RouteOptions) {
TODO("Not yet implemented")
}
override fun onRoutesRequestFailure(
throwable: Throwable,
routeOptions: RouteOptions
) {
TODO("Not yet implemented")
}
}
)
}
}
Logs:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.android, PID: 12096
java.lang.Error: Any tile edge can only be used once as part of the geometry
at com.mapbox.navigator.Navigator.getRouteBufferGeoJson(Native Method)
at com.mapbox.navigation.navigator.internal.MapboxNativeNavigatorImpl$setRoute$2.invokeSuspend(MapboxNativeNavigatorImpl.kt:143)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:56)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
/cc: @etl could you have a look?
@LukasPaczos @Guardiola31337 this issue seems to be trivial to debug if we could obtain any route for which we have this exception. Is it possible to find one?
@mark-lapasa would you be able to share the coordinates you are using for the route request that produces this exception?
@mark-lapasa and not only coordinates, but any parameters you are passing to Directions API, please
UPDATE
Sorry, didn't notice all route parameters from your snippet.
@mark-lapasa and not only coordinates, but any parameters you are passing to Directions API, please
UPDATE
Sorry, didn't notice all route parameters from your snippet.
Hope the following helps:
class SandboxFragment : BaseFragment() {
private lateinit var binding: FragmentSandboxBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
binding = FragmentSandboxBinding.inflate(inflater, container, false).apply {
// configureMapView(requireActivity(), mapView, Pair(48.85819, 2.29458), "Eiffel Tower")
configureMapView(
requireActivity(),
mapView,
listOf(
Place(lat = 48.85819, lng = 2.29458),
Place(lat = 48.85667232096175, lng = 2.2923376716963206)
),
viewLifecycleOwner
)
}
return binding.root
}
}
@mark-lapasa Do you see this exception consistently on every run? Would it be possible for you to save the contents of routes: List<DirectionsRoute> into a file and attach to the issue? This would help a lot! [having trouble reproducing it with a route request]
@mark-lapasa Do you see this exception consistently on every run? Would it be possible for you to save the contents of
routes: List<DirectionsRoute>into a file and attach to the issue? This would help a lot! [having trouble reproducing it with a route request]
@mskurydin This is a snapshot of what routes looks like. I just reproduced the issue again. I have a simple one Activity, many Fragment app. The first fragment that loads for the purposes of experimenting is the SandboxFragment that posted previously. So the crash is immediate if this SandboxFragment is loaded first.
@mskurydin Also to add more specifics, these are exact MapBox classes used in my original configureMapView() post:

@mark-lapasa for your own security going to remove the screenshot you shared that included potentially your access token 馃槵
Feel free to upload another screenshot hiding it or share plain text.
What are the coordinates for the route shown in the picture?
According to the encoded geometry, it shows Somalia (1 point):
lon/lat - [47.302239,3.75299],[47.302239,3.75299]
@mark-lapasa for your own security going to remove the screenshot you shared that included potentially your access token 馃槵
Feel free to upload another screenshot hiding it or share plain text.
Thx - I was gonna refresh all the tokens when it was going to prod. Doesn't help I had committed that secret key into the repro, lol. I'm solo developer on this project.
@mskurydin @Guardiola31337 - Second attempt at capturing the breakpoint. Not sure how in Android studio how to dump to text file.
@mskurydin The coordinates is Eifel Tower and some random point I chose that's 7 minute walk away. Definitely not Somalia.
Place #1 - (lat = 48.85819, lng = 2.29458),
Place #2 - (lat = 48.85667232096175, lng = 2.2923376716963206)

@mark-lapasa could you call routes[0].toJson() and paste the route JSON here? Please make sure to remove the access token that's appended to the end of that JSON string.
We have found the exact route responses and see that the lon/lat are confused during the request:
From the request (it's over the ocean)
"coordinates": [{"lon": 48.85819, "lat": 2.29458}, {"lon": 48.856672, "lat": 2.292338}]
Our services follow the lon-first model most of the time.
--
In any case, we do the follow-up investigation of why we get a weird route and why it causes a crash.