mapbox / mapbox-navigation-android

Mapbox Navigation SDK for Android
https://docs.mapbox.com/android/navigation/overview/
Other
620 stars 318 forks source link

BasicNavigationActivity IllegalStateException: Calling getSourceAs when a newer style is loading/has loaded. #3288

Open Guardiola31337 opened 4 years ago

Guardiola31337 commented 4 years ago

When testing https://github.com/mapbox/mapbox-navigation-android/pull/3287 and BasicNavigationActivity from the examples test app run into the following 💥

07-06 12:38:19.365 6967-6967/com.mapbox.navigation.examples E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.mapbox.navigation.examples, PID: 6967
    java.lang.IllegalStateException: Calling getSourceAs when a newer style is loading/has loaded.
        at com.mapbox.mapboxsdk.maps.Style.validateState(Style.java:777)
        at com.mapbox.mapboxsdk.maps.Style.getSourceAs(Style.java:148)
        at com.mapbox.mapboxsdk.location.SymbolLocationLayerRenderer.refreshSource(SymbolLocationLayerRenderer.java:321)
        at com.mapbox.mapboxsdk.location.SymbolLocationLayerRenderer.setBearingProperty(SymbolLocationLayerRenderer.java:337)
        at com.mapbox.mapboxsdk.location.SymbolLocationLayerRenderer.setCompassBearing(SymbolLocationLayerRenderer.java:172)
        at com.mapbox.mapboxsdk.location.LocationLayerController$3.onNewAnimationValue(LocationLayerController.java:276)
        at com.mapbox.mapboxsdk.location.LocationLayerController$3.onNewAnimationValue(LocationLayerController.java:273)
        at com.mapbox.mapboxsdk.location.MapboxAnimator.postUpdates(MapboxAnimator.java:104)
        at com.mapbox.mapboxsdk.location.MapboxAnimator.onAnimationUpdate(MapboxAnimator.java:91)
        at android.animation.ValueAnimator.animateValue(ValueAnimator.java:1463)
        at android.animation.ValueAnimator.setCurrentFraction(ValueAnimator.java:642)
        at android.animation.ValueAnimator.setCurrentPlayTime(ValueAnimator.java:589)
        at android.animation.ValueAnimator.start(ValueAnimator.java:1106)
        at android.animation.ValueAnimator.start(ValueAnimator.java:1117)
        at android.animation.AnimatorSet.start(AnimatorSet.java:586)
        at com.mapbox.mapboxsdk.location.MapboxAnimatorSetProvider.startAnimation(MapboxAnimatorSetProvider.java:31)
        at com.mapbox.mapboxsdk.location.LocationAnimatorCoordinator.playAnimators(LocationAnimatorCoordinator.java:373)
        at com.mapbox.mapboxsdk.location.LocationAnimatorCoordinator.resetAllLayerAnimations(LocationAnimatorCoordinator.java:467)
        at com.mapbox.mapboxsdk.location.LocationComponent.updateAnimatorListenerHolders(LocationComponent.java:1536)
        at com.mapbox.mapboxsdk.location.LocationComponent.access$1200(LocationComponent.java:98)
        at com.mapbox.mapboxsdk.location.LocationComponent$8.onCameraTrackingChanged(LocationComponent.java:1674)
        at com.mapbox.mapboxsdk.location.LocationCameraController.notifyCameraTrackingChangeListener(LocationCameraController.java:345)
        at com.mapbox.mapboxsdk.location.LocationCameraController.setCameraMode(LocationCameraController.java:123)
        at com.mapbox.mapboxsdk.location.LocationComponent.setCameraMode(LocationComponent.java:613)
        at com.mapbox.mapboxsdk.location.LocationComponent.setCameraMode(LocationComponent.java:577)
        at com.mapbox.navigation.ui.camera.NavigationCamera.setCameraMode(NavigationCamera.java:524)
        at com.mapbox.navigation.ui.camera.NavigationCamera.updateCameraTrackingMode(NavigationCamera.java:207)
        at com.mapbox.navigation.ui.map.NavigationMapboxMap.updateCameraTrackingMode(NavigationMapboxMap.java:550)
        at com.mapbox.navigation.examples.core.BasicNavigationActivity.updateCameraOnNavigationStateChange(BasicNavigationActivity.kt:292)
        at com.mapbox.navigation.examples.core.BasicNavigationActivity.access$updateCameraOnNavigationStateChange(BasicNavigationActivity.kt:51)
        at com.mapbox.navigation.examples.core.BasicNavigationActivity$initListeners$1.onClick(BasicNavigationActivity.kt:177)
        at android.view.View.performClick(View.java:5204)
        at android.view.View$PerformClick.run(View.java:21153)
        at android.os.Handler.handleCallback(Handler.java:739)
        at android.os.Handler.dispatchMessage(Handler.java:95)
        at android.os.Looper.loop(Looper.java:148)
        at android.app.ActivityThread.main(ActivityThread.java:5417)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

cc @LukasPaczos @cafesilencio

stale[bot] commented 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.