No component is needed. Issue reproduces without loading a map.
Observed behavior and steps to reproduce
Calling OfflineManager crashes the app.
Happens only when upgrading from an older version and an offline pack has been saved earlier.
Steps:
install 10.0.0-beta.68 + 10.10.2
create offline pack
upgrade to #main + 10.13.0-beta.1
call a method on OfflineManager, e.g. await MapboxGL.offlineManager.resetDatabase()
app crashes
Expected behavior
App does not crash.
Notes / preliminary analysis
Each crash boils down to a single line failing to convert JSON.
Stacktrace:
04-18 00:49:30.212 6214 6214 D AndroidRuntime: Shutting down VM
04-18 00:49:30.215 6214 6214 E AndroidRuntime: FATAL EXCEPTION: main
04-18 00:49:30.215 6214 6214 E AndroidRuntime: Process: com.eagronommobile, PID: 6214
04-18 00:49:30.215 6214 6214 E AndroidRuntime: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
04-18 00:49:30.215 6214 6214 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:558)
04-18 00:49:30.215 6214 6214 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
04-18 00:49:30.215 6214 6214 E AndroidRuntime: Caused by: java.lang.reflect.InvocationTargetException
04-18 00:49:30.215 6214 6214 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
04-18 00:49:30.215 6214 6214 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
04-18 00:49:30.215 6214 6214 E AndroidRuntime: ... 1 more
04-18 00:49:30.215 6214 6214 E AndroidRuntime: Caused by: org.json.JSONException: Value {"name":"default_offline_pack"} of type java.lang.String cannot be converted to JSONObject
04-18 00:49:30.215 6214 6214 E AndroidRuntime: at org.json.JSON.typeMismatch(JSON.java:112)
04-18 00:49:30.215 6214 6214 E AndroidRuntime: at org.json.JSONObject.<init>(JSONObject.java:172)
04-18 00:49:30.215 6214 6214 E AndroidRuntime: at org.json.JSONObject.<init>(JSONObject.java:185)
04-18 00:49:30.215 6214 6214 E AndroidRuntime: at com.mapbox.rctmgl.utils.extensions.ValueKt.toJSONObject(Value.kt:8)
04-18 00:49:30.215 6214 6214 E AndroidRuntime: at com.mapbox.rctmgl.modules.RCTMGLOfflineModule.convertRegionsToJSON(RCTMGLOfflineModule.kt:374)
04-18 00:49:30.215 6214 6214 E AndroidRuntime: at com.mapbox.rctmgl.modules.RCTMGLOfflineModule.access$convertRegionsToJSON(RCTMGLOfflineModule.kt:93)
04-18 00:49:30.215 6214 6214 E AndroidRuntime: at com.mapbox.rctmgl.modules.RCTMGLOfflineModule$getPacks$1$run$1.run(RCTMGLOfflineModule.kt:251)
04-18 00:49:30.215 6214 6214 E AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:942)
04-18 00:49:30.215 6214 6214 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:99)
04-18 00:49:30.215 6214 6214 E AndroidRuntime: at android.os.Looper.loopOnce(Looper.java:201)
04-18 00:49:30.215 6214 6214 E AndroidRuntime: at android.os.Looper.loop(Looper.java:288)
04-18 00:49:30.215 6214 6214 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:7872)
04-18 00:49:30.215 6214 6214 E AndroidRuntime: ... 3 more
04-18 00:49:30.228 577 754 W ActivityTaskManager: Force finishing activity com.eagronommobile/com.eagronom.mobile.MainActivity
Mapbox Implementation
Mapbox
Mapbox Version
10.13.0-beta.1
Platform
Android
@rnmapbox/maps
versionmain
Standalone component to reproduce
No component is needed. Issue reproduces without loading a map.
Observed behavior and steps to reproduce
Calling OfflineManager crashes the app.
Happens only when upgrading from an older version and an offline pack has been saved earlier.
Steps:
10.0.0-beta.68
+10.10.2
#main
+10.13.0-beta.1
await MapboxGL.offlineManager.resetDatabase()
Expected behavior
App does not crash.
Notes / preliminary analysis
Each crash boils down to a single line failing to convert JSON.
Stacktrace:
Additional links and references
No response