MapUserStyleObserver does not handle local JSON styles
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 45/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- android, kotlin
- Domain
- mobile-dev
Research direction
Start with MapUserStyleObserver.kt at the referenced line and inspect how the style URL is handled when the style is loaded from MainCarSession.kt. Reproduce the Android Auto flow with a local JSON style, then verify that both local JSON and cloud-based styles avoid the reported IndexOutOfBoundsException.
Written by the indexing model from the issue text.
Description
Android API: 33
Mapbox Navigation SDK version: 3.0.4
Steps to trigger behavior
- Use the
android-autoexample from this repo as a basis. - Load a map style from a local JSON file in
android-auto-app/src/main/java/com/mapbox/navigation/examples/androidauto/car/MainCarSession.kt - Search a route to a destination and start a trip.
Expected behavior
Navigation SDK for Android Auto should handle both cloud-based as well as local JSON styles.
Actual behavior
The following error is thrown:
java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
at java.util.Collections$SingletonList.get(Collections.java:5042)
at com.mapbox.navigation.ui.androidauto.navigation.MapUserStyleObserver.updateState(MapUserStyleObserver.kt:29)
at com.mapbox.navigation.ui.androidauto.navigation.MapUserStyleObserver.onAttached(MapUserStyleObserver.kt:19)
at com.mapbox.navigation.ui.androidauto.navigation.roadlabel.CarRoadLabelRenderer.onAttached(CarRoadLabelRenderer.kt:77)
at com.mapbox.maps.extension.androidauto.CarMapSurfaceOwner.registerObserver$extension_androidauto_release(CarMapSurfaceOwner.kt:54)
at com.mapbox.maps.extension.androidauto.MapboxCarMap.registerObserver(MapboxCarMap.kt:149)
at com.mapbox.navigation.ui.androidauto.freedrive.FreeDriveCarScreen$1.onResume(FreeDriveCarScreen.kt:46)
at androidx.lifecycle.DefaultLifecycleObserverAdapter.onStateChanged(DefaultLifecycleObserverAdapter.kt:26)
at androidx.lifecycle.LifecycleRegistry$ObserverWithState.dispatchEvent(LifecycleRegistry.jvm.kt:320)
at androidx.lifecycle.LifecycleRegistry.forwardPass(LifecycleRegistry.jvm.kt:257)
at androidx.lifecycle.LifecycleRegistry.sync(LifecycleRegistry.jvm.kt:293)
at androidx.lifecycle.LifecycleRegistry.moveToState(LifecycleRegistry.jvm.kt:142)
at androidx.lifecycle.LifecycleRegistry.handleLifecycleEvent(LifecycleRegistry.jvm.kt:124)
at androidx.car.app.Screen.lambda$dispatchLifecycleEvent$1$androidx-car-app-Screen(Screen.java:340)
at androidx.car.app.Screen$$ExternalSyntheticLambda1.run(Unknown Source:4)
at androidx.car.app.utils.ThreadUtils.runOnMain(ThreadUtils.java:38)
at androidx.car.app.Screen.dispatchLifecycleEvent(Screen.java:328)
at androidx.car.app.ScreenManager.popInternal(ScreenManager.java:375)
at androidx.car.app.ScreenManager.popToRoot(ScreenManager.java:216)
at com.mapbox.navigation.ui.androidauto.screenmanager.MapboxScreenManager.replaceTop(MapboxScreenManager.kt:235)
at com.mapbox.navigation.ui.androidauto.screenmanager.MapboxScreenManager.onReplaceTop(MapboxScreenManager.kt:230)
at com.mapbox.navigation.ui.androidauto.screenmanager.MapboxScreenManager.onScreenEvent(MapboxScreenManager.kt:210)
at com.mapbox.navigation.ui.androidauto.screenmanager.MapboxScreenManager.access$onScreenEvent(MapboxScreenManager.kt:68)
at com.mapbox.navigation.ui.androidauto.screenmanager.MapboxScreenManager$lifecycleObserver$1$onCreate$1$1.emit(MapboxScreenManager.kt:81)
at com.mapbox.navigation.ui.androidauto.screenmanager.MapboxScreenManager$lifecycleObserver$1$onCreate$1$1.emit(MapboxScreenManager.kt:81)
at kotlinx.coroutines.flow.SharedFlowImpl.collect$suspendImpl(SharedFlow.kt:382)
at kotlinx.coroutines.flow.SharedFlowImpl$collect$1.invokeSuspend(Unknown Source:15)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTaskKt.resume(DispatchedTask.kt:235)
at kotlinx.coroutines.DispatchedTaskKt.resumeUnconfined(DispatchedTask.kt:191)
at kotlinx.coroutines.DispatchedTaskKt.dispatch(DispatchedTask.kt:163)
at kotlinx.coroutines.CancellableContinuationImpl.dispatchResume(CancellableContinuationImpl.kt:474)
at kotlinx.coroutines.CancellableContinuationImpl.resumeImpl(CancellableContinuationImpl.kt:508)
at kotlinx.coroutines.CancellableContinuationImpl.resumeImpl$default(CancellableContinuationImpl.kt:497)
at kotlinx.coroutines.CancellableContinuationImpl.resumeWith(CancellableContinuationImpl.kt:368)
at kotlinx.coroutines.flow.SharedFlowImpl.tryEmit(SharedFlow.kt:399)
at com.mapbox.navigation.ui.androidauto.screenmanager.MapboxScreenManager$Companion.replaceTop(MapboxScreenManager.kt:292)
at com.mapbox.navigation.ui.androidauto.preview.CarRoutePreviewScreen.onGetTemplate$lambda$2(CarRoutePreviewScreen.kt:128)
at com.mapbox.navigation.ui.androidauto.preview.CarRoutePreviewScreen.$r8$lambda$cjvY8ej50Xno8ZQZK_I0s37EBd0(Unknown Source:0)
at com.mapbox.navigation.ui.androidauto.preview.CarRoutePreviewScreen$$ExternalSyntheticLambda1.onClick(Unknown Source:2)
at androidx.car.app.model.OnClickDelegateImpl$OnClickListenerStub.lambda$onClick$0$androidx-car-app-model-OnClickDelegateImpl$OnClickListenerStub(OnClickDelegateImpl.java:96)
at androidx.car.app.model.OnClickDelegateImpl$OnClickListenerStub$$ExternalSyntheticLambda0.dispatch(Unknown Source:2)
at androidx.car.app.utils.RemoteUtils.lambda$dispatchCallFromHost$0(RemoteUtils.java:148)
at androidx.car.app.utils.RemoteUtils$$ExternalSyntheticLambda1.run(Unknown Source:6)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8762)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:604)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)
Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@67854e4, Dispatchers.Main.immediate]
As far as I can tell, the reason seems to be this expectation of an URL scheme.
- Dominant language
- Kotlin
- Stars
- 651
- Forks
- 321
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from mapbox/mapbox-navigation-android
-
Difficulty 1/5 1-3 hours Newbie friendliness 65/100
mapbox/mapbox-navigation-android#7852 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
mapbox/mapbox-navigation-android#7966 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
mapbox/mapbox-navigation-android#7965 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 58/100
mapbox/mapbox-navigation-android#7955 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
mapbox/mapbox-navigation-android#7948 ·
All issues in mapbox/mapbox-navigation-android
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Anthonyy232/Paperize#614 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
bitcoindevkit/bdk-ffi#1125 ·
-
Issue: Bug
Difficulty 1/5 Under an hour Newbie friendliness 91/100
OpenAPITools/openapi-generator#24978 ·
-
helsemelding-json-schema json-schema-core
Difficulty 2/5 1-3 hours Newbie friendliness 68/100