mapbox / mapbox/mapbox-navigation-android

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

Open
#3,288 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug UI
Dominant language
Kotlin
Stars
651
Forks
321
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the crash in the examples test app while testing pull request 3287, then start at BasicNavigationActivity.kt lines 292 and 177 and follow the stack trace into the camera and location components. Done means the navigation state change no longer triggers the reported IllegalStateException.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.