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

sometimes app crash when remove app from recent app list #406

Closed
hussenIbrahim opened this issue Sep 5, 2020 · 6 comments
Closed

sometimes app crash when remove app from recent app list #406

hussenIbrahim opened this issue Sep 5, 2020 · 6 comments

Comments

@hussenIbrahim
Copy link

sometimes app crash when remove app from recent app list
i think it because of the map or the style is not loaded yet completely
how to avoid this crash
[ +22 ms] D/AndroidRuntime(23986): Shutting down VM [ +41 ms] E/AndroidRuntime(23986): FATAL EXCEPTION: main [ +7 ms] E/AndroidRuntime(23986): Process: com.realestate.user, PID: 23986 [ +43 ms] E/AndroidRuntime(23986): java.lang.RuntimeException: Unable to destroy activity {com.realestate.user/com.realestate.user.MainActivity}: java.lang.IllegalStateException: Calling getLayer when a newer style is loading/has loaded. [ +84 ms] E/AndroidRuntime(23986): at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:5193) [ +80 ms] E/AndroidRuntime(23986): at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:5227) [ +47 ms] E/AndroidRuntime(23986): at android.app.servertransaction.DestroyActivityItem.execute(DestroyActivityItem.java:44) [ +47 ms] E/AndroidRuntime(23986): at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176) [ +54 ms] E/AndroidRuntime(23986): at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97) [ +41 ms] E/AndroidRuntime(23986): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2147) [ +39 ms] E/AndroidRuntime(23986): at android.os.Handler.dispatchMessage(Handler.java:107) [ +2 ms] E/AndroidRuntime(23986): at android.os.Looper.loop(Looper.java:237) [ +7 ms] E/AndroidRuntime(23986): at android.app.ActivityThread.main(ActivityThread.java:7814) [ +23 ms] E/AndroidRuntime(23986): at java.lang.reflect.Method.invoke(Native Method) [ +24 ms] E/AndroidRuntime(23986): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) [ +6 ms] E/AndroidRuntime(23986): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1075) [ ] E/AndroidRuntime(23986): Caused by: java.lang.IllegalStateException: Calling getLayer when a newer style is loading/has loaded. [ +2 ms] E/AndroidRuntime(23986): at com.mapbox.mapboxsdk.maps.Style.validateState(Style.java:777) [ +2 ms] E/AndroidRuntime(23986): at com.mapbox.mapboxsdk.maps.Style.getLayer(Style.java:240) [ +4 ms] E/AndroidRuntime(23986): at com.mapbox.mapboxsdk.location.SymbolLocationLayerRenderer.setLayerVisibility(SymbolLocationLayerRenderer.java:247) [ +51 ms] E/AndroidRuntime(23986): at com.mapbox.mapboxsdk.location.SymbolLocationLayerRenderer.hide(SymbolLocationLayerRenderer.java:109) [ +104 ms] E/AndroidRuntime(23986): at com.mapbox.mapboxsdk.location.LocationLayerController.hide(LocationLayerController.java:138) [ +2 ms] E/AndroidRuntime(23986): at com.mapbox.mapboxsdk.location.LocationComponent.disableLocationComponent(LocationComponent.java:1392) [ +1 ms] E/AndroidRuntime(23986): at com.mapbox.mapboxsdk.location.LocationComponent.setLocationComponentEnabled(LocationComponent.java:518)[ +2 ms] E/AndroidRuntime(23986): at com.mapbox.mapboxgl.MapboxMapController.dispose(MapboxMapController.java:861) [ +64 ms] E/AndroidRuntime(23986): at io.flutter.plugin.platform.VirtualDisplayController.dispose(VirtualDisplayController.java:171) [ +66 ms] E/AndroidRuntime(23986): at io.flutter.plugin.platform.PlatformViewsController.flushAllViews(PlatformViewsController.java:640) [ +30 ms] E/AndroidRuntime(23986): at io.flutter.plugin.platform.PlatformViewsController.onDetachedFromJNI(PlatformViewsController.java:522) [ +43 ms] E/AndroidRuntime(23986): at io.flutter.embedding.engine.FlutterEngine.destroy(FlutterEngine.java:361) [ +5 ms] E/AndroidRuntime(23986): at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.onDetach(FlutterActivityAndFragmentDelegate.java:522) [ +81 ms] E/AndroidRuntime(23986): at io.flutter.embedding.android.FlutterActivity.onDestroy(FlutterActivity.java:578) [ +4 ms] E/AndroidRuntime(23986): at android.app.Activity.performDestroy(Activity.java:8217) [ +47 ms] E/AndroidRuntime(23986): at android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1342) [ +1 ms] E/AndroidRuntime(23986): at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:5178) [ +2 ms] E/AndroidRuntime(23986): ... 11 more

@strepier
Copy link
Contributor

strepier commented Oct 1, 2020

Easy to reproduce on Xiaomi Mi A3 (Android One)... Any clue ?

@MATTYGILO
Copy link

I'm having the same issue!!!!

@andrea689
Copy link
Collaborator

maybe v0.9.0 resolve this issue (#266)

@miljan-mxc
Copy link

I'm having the same issue closing the app on back button on Android 6,7,8. Also with v0.9.0.
Anybody got a solution for this?

E/AndroidRuntime( 6469): Caused by: java.lang.IllegalStateException: Calling getLayer when a newer style is loading/has loaded. E/AndroidRuntime( 6469): at com.mapbox.mapboxsdk.maps.Style.validateState(Style.java:786) E/AndroidRuntime( 6469): at com.mapbox.mapboxsdk.maps.Style.getLayer(Style.java:240) E/AndroidRuntime( 6469): at com.mapbox.mapboxsdk.location.SymbolLocationLayerRenderer.setLayerVisibility(SymbolLocationLayerRenderer.java:247) E/AndroidRuntime( 6469): at com.mapbox.mapboxsdk.location.SymbolLocationLayerRenderer.hide(SymbolLocationLayerRenderer.java:109) E/AndroidRuntime( 6469): at com.mapbox.mapboxsdk.location.LocationLayerController.hide(LocationLayerController.java:146) E/AndroidRuntime( 6469): at com.mapbox.mapboxsdk.location.LocationComponent.disableLocationComponent(LocationComponent.java:1499) E/AndroidRuntime( 6469): at com.mapbox.mapboxsdk.location.LocationComponent.setLocationComponentEnabled(LocationComponent.java:523) E/AndroidRuntime( 6469): at io.flutter.plugins.mapboxnative.MapboxController.dispose(MapboxController.java:650) E/AndroidRuntime( 6469): at io.flutter.plugin.platform.VirtualDisplayController.dispose(VirtualDisplayController.java:171) E/AndroidRuntime( 6469): at io.flutter.plugin.platform.PlatformViewsController.flushAllViews(PlatformViewsController.java:683) E/AndroidRuntime( 6469): at io.flutter.plugin.platform.PlatformViewsController.onDetachedFromJNI(PlatformViewsController.java:565) E/AndroidRuntime( 6469): at io.flutter.embedding.engine.FlutterEngine.destroy(FlutterEngine.java:366) E/AndroidRuntime( 6469): at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.onDetach(FlutterActivityAndFragmentDelegate.java:528) E/AndroidRuntime( 6469): at io.flutter.embedding.android.FlutterFragment.onDetach(FlutterFragment.java:644) E/AndroidRuntime( 6469): at androidx.fragment.app.Fragment.performDetach(Fragment.java:2839)

@MATTYGILO
Copy link

I haven't fully tested this out to see if the error is gone after this fix. The error is due to code being run to manipulate the map e.g. using map controller whilst the map has not yet been created.

Basically I add a await Future.doWhile(mapCreated) on any function that may manipulate the map then in the on map created function once the map is created I set mapCreated to true.

@tobrun
Copy link
Collaborator

tobrun commented Nov 7, 2020

This should be fixed with upgrading to a newer Android SDK version -> #413

@tobrun tobrun closed this as completed Nov 7, 2020
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

6 participants