Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MapUserStyleObserver does not handle local JSON styles #7824

Open
6d7a opened this issue Jun 4, 2024 · 0 comments
Open

MapUserStyleObserver does not handle local JSON styles #7824

6d7a opened this issue Jun 4, 2024 · 0 comments

Comments

@6d7a
Copy link

6d7a commented Jun 4, 2024

Android API: 33
Mapbox Navigation SDK version: 3.0.4

Steps to trigger behavior

  1. Use the android-auto example from this repo as a basis.
  2. Load a map style from a local JSON file in android-auto-app/src/main/java/com/mapbox/navigation/examples/androidauto/car/MainCarSession.kt
  3. 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant