mapbox-gl-native
mapbox-gl-native copied to clipboard
App crash when implementing mapbox sdk and app is in background
Platform: Android Mapbox SDK version: com.mapbox.mapboxsdk:mapbox-android-sdk:5.1.3@aar
Steps to trigger behavior
- When app is in background we are using other apps then open our app its crash.
- When device idle and app is in background
- Device idle app is in foreground and we are not on map screen
Expected behavior
- Mapbox is working fine but its crash when app is in background for sometime. Here is my crash Log: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.mapbox.mapboxsdk.maps.NativeMapView.createSurface(android.view.Surface)' on a null object reference at com.mapbox.mapboxsdk.maps.MapView$SurfaceCallback.surfaceCreated(MapView.java:426) at android.view.SurfaceView.updateWindow(SurfaceView.java:656) at android.view.SurfaceView.onWindowVisibilityChanged(SurfaceView.java:266) at android.view.View.dispatchWindowVisibilityChanged(View.java:11139) at
Getting similar error
java.lang.NullPointerException Attempt to invoke virtual method 'void com.mapbox.mapboxsdk.maps.NativeMapView.createSurface(android.view.Surface)' on a null object reference
MapView.java:427 com.mapbox.mapboxsdk.maps.MapView$SurfaceCallback.surfaceCreated
SurfaceView.java:593 android.view.SurfaceView.updateWindow
SurfaceView.java:246 android.view.SurfaceView.onWindowVisibilityChanged
View.java:9737 android.view.View.dispatchWindowVisibilityChanged
ViewGroup.java:1309 android.view.ViewGroup.dispatchWindowVisibilityChanged
ViewGroup.java:1309 android.view.ViewGroup.dispatchWindowVisibilityChanged
ViewGroup.java:1309 android.view.ViewGroup.dispatchWindowVisibilityChanged
ViewGroup.java:1309 android.view.ViewGroup.dispatchWindowVisibilityChanged
ViewGroup.java:1309 android.view.ViewGroup.dispatchWindowVisibilityChanged
ViewGroup.java:1309 android.view.ViewGroup.dispatchWindowVisibilityChanged
ViewGroup.java:1309 android.view.ViewGroup.dispatchWindowVisibilityChanged
ViewGroup.java:1309 android.view.ViewGroup.dispatchWindowVisibilityChanged
ViewGroup.java:1309 android.view.ViewGroup.dispatchWindowVisibilityChanged
ViewGroup.java:1309 android.view.ViewGroup.dispatchWindowVisibilityChanged
ViewGroup.java:1309 android.view.ViewGroup.dispatchWindowVisibilityChanged
ViewGroup.java:1309 android.view.ViewGroup.dispatchWindowVisibilityChanged
ViewRootImpl.java:1414 android.view.ViewRootImpl.performTraversals
ViewRootImpl.java:1138 android.view.ViewRootImpl.doTraversal
ViewRootImpl.java:6227 android.view.ViewRootImpl$TraversalRunnable.run
Choreographer.java:884 android.view.Choreographer$CallbackRecord.run
Choreographer.java:696 android.view.Choreographer.doCallbacks
Choreographer.java:631 android.view.Choreographer.doFrame
Choreographer.java:870 android.view.Choreographer$FrameDisplayEventReceiver.run
Handler.java:743 android.os.Handler.handleCallback
Handler.java:95 android.os.Handler.dispatchMessage
Looper.java:150 android.os.Looper.loop
ActivityThread.java:5546 android.app.ActivityThread.main
Method.java:-2 java.lang.reflect.Method.invoke
ZygoteInit.java:794 com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run
ZygoteInit.java:684 com.android.internal.os.ZygoteInit.main

Since 5.1.3 multiple changes were made to the render setup, feel free to communicate back if this issue is still reproducible with a recent version of the SDK. Thank you for reporting this issue! closing.