Reputation: 3608
I was using the mapbox sdk 6.3.0. I can add a polygon to the map and I am enabling the user to drag it by changing the feature and then updating the Featurecollection as follows:
features.set(features.indexOf(oldFeature), newFeature);
symbolsSource.setGeoJson(symbolsCollection);
Everything was working fine.
Then I tried to update the SDK from 6.3.0 to 7.3.0 Then all of a sudden while dragging I am getting the following crash(its intermittent but it is frequent)
2019-04-29 17:58:03.119 24115-24204/com.app.fr.dev A/stresponder.de: java_vm_ext.cc:542] JNI DETECTED ERROR IN APPLICATION: can't call java.lang.String com.mapbox.geojson.Feature.id() on null object 2019-04-29 17:58:03.119 24115-24204/com.app.fr.dev A/stresponder.de: java_vm_ext.cc:542] in call to CallObjectMethodV 2019-04-29 17:58:03.119 24115-24204/com.app.fr.dev A/stresponder.de: java_vm_ext.cc:542] "Thread-2368" prio=10 tid=65 Runnable 2019-04-29 17:58:03.119 24115-24204/com.app.fr.dev A/stresponder.de: java_vm_ext.cc:542] | group="main" sCount=0 dsCount=0 flags=0 obj=0x1b740000 self=0x763d1b6800 2019-04-29 17:58:03.119 24115-24204/com.app.fr.dev A/stresponder.de: java_vm_ext.cc:542] | sysTid=24204 nice=-10 cgrp=default sched=0/0 handle=0x76385da4f0 2019-04-29 17:58:03.120 24115-24204/com.app.fr.dev A/stresponder.de: java_vm_ext.cc:542] | state=R schedstat=( 1253639661 195250540 1454 ) utm=117 stm=8 core=7 HZ=100 2019-04-29 17:58:03.120 24115-24204/com.app.fr.dev A/stresponder.de: java_vm_ext.cc:542] | stack=0x76384df000-0x76384e1000 stackSize=1009KB 2019-04-29 17:58:03.120 24115-24204/com.app.fr.dev A/stresponder.de: java_vm_ext.cc:542] | held mutexes= "mutator lock"(shared held)....
There is no log which points to any point in my code. I am hoping this might be a problem with Mapbox SDK, because when I revert back to 6.3.0 its working fine. I am not able to pinpoint the actual issue. Can someone tell me how to actually debug such a crash?
Please let me know if I should provide more info.
Thanks in advance.
Edit: This is not a duplicate of nullpointer, because this is not happening to my code. It is happening inside the Mapbox sdk as you can see from the log. Also please note that the error thrown is JNI error.
Upvotes: 2
Views: 998
Reputation: 3608
I raised an issue in Mapbox SDK and they have given me a way as a workaround for this issue.
While dragging, instead of setting the geojson directly like this
symbolsSource.setGeoJson(symbolsCollection);
We should set it like this:
symbolsSource.setGeoJson(FeatureCollection.fromFeatures(new ArrayList<>(symbolsCollection.features())));
They have also updated the SDK as well. Look here for the issue.
Upvotes: 2