0

I have implemented mapbox as they guided in their documentation. https://www.mapbox.com/android-docs/map-sdk/overview/

My implementation is on a fragment and everything is working fine in all Android versions except Android Oreo platform. Only in Oreo, there occurs a FATAL crash with an error as shown below:

 JNI DETECTED ERROR IN APPLICATION: can't call void com.mapbox.mapboxsdk.maps.NativeMapView.onInvalidate() on null object

I have contacted Mapbox support several times but no response. My Mapbox SDK version is 5.1.3

  • Possible duplicate of [What is a NullPointerException, and how do I fix it?](https://stackoverflow.com/questions/218384/what-is-a-nullpointerexception-and-how-do-i-fix-it) – M. Prokhorov Sep 12 '17 at 16:02
  • Sorry to hear that Mapbox support hasn't got back to you. Would you be able to report this on the project issue tracker? https://github.com/mapbox/mapbox-gl-native/issues – Tobrun Sep 12 '17 at 16:23
  • @M.Prokhorov No. This is not a NullPointerException. When I debug, I can see the values for the mapView but then this error is generated from the Native Interface. And hence this is not a duplicate of anything. Thanks. – Mohammed Ibrahim Sep 12 '17 at 18:57
  • @Tobrun Yes, I will add this to the issue tracker. Thanks. – Mohammed Ibrahim Sep 12 '17 at 18:57
  • @MohammedIbrahim, but it is clearly a null pointer exception, just not of your doing. I did do some digging, and it appears that your library holds only a weak reference to map implementation. According to [JNI docs](http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/functions.html#weak) (and common knowledge), weak refs can be garbage collected at any time. It looks like Oreo's Garbage Collector just a little bit more eager to do its job, which is fair since that version claims to focus on battery saving. – M. Prokhorov Sep 13 '17 at 09:05
  • @M.Prokhorov Thanks a lot. Any suggestions for making it not a weak reference in my implementation? – Mohammed Ibrahim Sep 13 '17 at 14:33
  • @MohammedIbrahim do you have control over sources of MapBox? – M. Prokhorov Sep 13 '17 at 14:50
  • @M.Prokhorov No i do not. This issue is now been tracked here https://github.com/mapbox/mapbox-gl-native/issues/9981 – Mohammed Ibrahim Sep 13 '17 at 17:47
  • @M.Prokhorov Thank you very much for looking into it. Appreciate it. – Mohammed Ibrahim Sep 13 '17 at 17:49
  • @MohammedIbrahim, looks like the issue is addressed now. – M. Prokhorov Sep 13 '17 at 17:53

0 Answers0