nitaliano / react-native-mapbox-gl

A Mapbox GL react native module for creating custom maps
Other
2.16k stars 697 forks source link

onSnapshotReady crash on Android 8.1 / 9.0 with master #1554

Open mutablestudio opened 5 years ago

mutablestudio commented 5 years ago

Project is Expo detached. We switched package.json to point to master, and when we call snapshot manager in a release build (works fine in dev mode) it produces this crash:

Android: 8.1.0 (also 9) Android Build: OPM7.181205.001 Manufacturer: Huawei Model: Nexus 6P (also Pixel 3) Thread: main-2

java.lang.IllegalArgumentException: Prefix string too short at java.io.File.createTempFile(File.java:1976) at com.mapbox.rctmgl.c.a.a(BitmapUtils.java:69) at com.mapbox.rctmgl.modules.RCTMGLSnapshotModule$1$1.onSnapshotReady(RCTMGLSnapshotModule.java:82) at com.mapbox.mapboxsdk.snapshotter.MapSnapshotter$1.run(MapSnapshotter.java:438) at android.os.Handler.handleCallback(Handler.java:790) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6494) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

We have writeToDisk: true for Mapbox.snapshotManager.takeSnap() - manifest has read/write storage permissions.

Flow to repro this:

related to #1546

TIA

kristfal commented 5 years ago

Just to try to isolate root cause, can you run the example project on the same device to identify if this is an expo-related issue or not?

mutablestudio commented 5 years ago

@kristfal setting writeToDisk: false is a workaround, did not have a chance to run the example project

Jackyaung commented 5 years ago

@mutablestudio do you know where I can set writeToDisk to false? I have a same problem , it cause android crash

mutablestudio commented 5 years ago

@Jackyaung where you call Mapbox.snapshotManager.takeSnap(), pass in writeToDisk: false, as one of the props

PeterFred commented 1 year ago

This is still an issue. writeToDisk: false does not solve the issue. Any other solution?