-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Android: JNI error: can't call java.lang.String com.mapbox.geojson.Feature.id() on null object #14565
Comments
Thanks for reaching out @jimmyjzemoso. Unfortunately, from the provided code I'm unable to judge whether there's a chance of the feature actually being Would you be able to provide a small, self-contained reproducible example? |
Hi @LukasPaczos thanks for getting back. I will try to provide such an example. |
Hi @LukasPaczos I have made a sample app and added you and @tobrun as a collaborator. Please tap on the map to add a polygon and drag it to invoke the crash. |
Hi @LukasPaczos I wanted to add current location marker with locationlayer plugin on 6.3.2. The same crash was happening in to 6.3.2 if we add locationlayerplugin and drag the map. |
Thanks for the example project @jimmyjzemoso! I was able to reproduce the issue and the root cause is our internal feature conversion. The conversion from Java to C++ features is asynchronous, and because you are often modifying and clearing the original Java collection, it can be cleared and nullify all of the records while the conversion is happening on a worker thread. To fix the issue without modifying your current logic, whenever you update a
call
I verified that this resolves your particular issue and can serve as a workaround, but since the feature conversion is not documented and would've been hard to synchronize, I'm also going to follow up with a PR that copies the collection when it's passed to the core by default.
Unfortunately, the |
@LukasPaczos Thank you for the update. I will test it and let you know. |
That's because we've only introduced the async features conversion in the |
@LukasPaczos The workaround is working. Thanks. Will this change be added in the next release?? |
yes, this fix can be tested with the |
I am dragging a
feature
by updating it. When I rapidly move thefeature
this error happens and the app crashes:This is the whole log:
I also noticed a sudden drop in memory usage from 160 to 75mb in the android profiler just before the crash.
This is what I am doing while dragging:
Expected behavior
The app should not crash
Actual behavior
The app is crashing with JNI error.
Configuration
Android versions: Android Pie
Device models: One plus 5, Pixel 2
Mapbox SDK versions: 7.3.0, 7.3.2
The text was updated successfully, but these errors were encountered: