Open NathanaelA opened 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.
Thanks for using the Mapbox Navigation SDK for Android and being a valued customer.
Mapbox will be soon deprecating any support for v0
and v1
versions of the SDK. To facilitate this transition we’re launching a new drop-in UI component into v2
, equivalent to the existing NavigationView
v1
in its design goals, however with a more modern and customizable API.
We plan to launch this new drop-in UI component as a Developer Preview feature in April, as part of the v2.5
series. Since you are using NavigationView
with v1
, we’d love to hear your feedback so that we can incorporate it ahead of a GA release.
If you’re interested in having early access to the upcoming drop-in UI for v2
and its documentation, drop a comment on this ticket or send an email to abhishek.kejriwal@mapbox.com
/cc @zugaldia @AhmerKhan1
Mapbox Navigation SDK version: com.mapbox.mapboxsdk:mapbox-android-sdk:9.6.0 (And current master as of Feb 18th, 2021)
Steps to trigger behavior
29.0508283 -80.90549659999999
&29.0485303934386 -80.90262127450215
(But I don't believe this matters, what matters is no waypoints)currentRoute
.[RouteLeg{distance=524.076, duration=71.744, durationTypical=null, summary=North Atlantic Avenue, Beachway Avenue, admins=[Admin{countryCode=US, countryCodeAlpha3=USA}], steps=[], incidents=null, annotation=null}]
steps
this._mapbox.startNavigation
using this route)Expected behavior
Works and doesn't crash
Actual behavior
Same callstack as #3449
Reason Why
This code loops thru the legs, and works... https://github.com/mapbox/mapbox-navigation-android/blob/e1f0918b6e73ceaf8bd3d1ef3886c8600289b184/libnavui-maps/src/main/java/com/mapbox/navigation/ui/maps/internal/route/line/MapboxRouteLineUtils.kt#L463
Calls this function with
it = leg
and0 = index
: https://github.com/mapbox/mapbox-navigation-android/blob/e1f0918b6e73ceaf8bd3d1ef3886c8600289b184/libnavui-maps/src/main/java/com/mapbox/navigation/ui/maps/internal/route/line/MapboxRouteLineUtils.kt#L486However, if you notice the above
steps
supplied by the MapBox directions API, it is an empty array; so the: The key part is this:leg.steps()?.get(index)?
lets dissect it...leg.steps()?
<- Exists and is NOT null (good so far), but then.get(index)?
since there is no0
item in the steps array the .get crashes with the error:java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
as you are trying to get a element out of a zero sized array.Workaround
When using the MapBoxDirection Builder, pass
.steps(true)
into it so that it will create items in the steps array.