NullPointerException: Attempt to invoke virtual method 'void com.esri.arcgisruntime.internal.jni.CoreDevice.b()' on a null object

680
5
06-22-2021 01:10 AM
GeobuzonAplicaciones
New Contributor

I get this error on Crashlytics console, with no other information.

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.esri.arcgisruntime.internal.jni.CoreDevice.b()' on a null object reference
at com.esri.arcgisruntime.mapping.view.GeoView$RenderingThread.run(SourceFile:13)

I don't know where it is happening. I have no more information

I use kotlin and  com.esri.arcgisruntime:arcgis-android:100.11.0

this error happens some times not all time

0 Kudos
5 Replies
NicolasElgueta
New Contributor II

you should handle the null data inside the calls, you can add a try catch to handle the error.
if you can upload an extract of the code that produces the error.

0 Kudos
GeobuzonAplicaciones
New Contributor

This reply and nothing are the same. 

0 Kudos
RamaChintapalli
Esri Contributor

Hi,

We have seen this error reported from another source but with further debugging found that their app was incorrectly handling the orientation changes. In their case, the mapview was sent to a background activity/fragment and it is being disposed even before instantiating the mapview.

If you have any code that you can share, it can help us debug further you case. You can use one of our samples, try to repro your workflow and share with us.
https://github.com/Esri/arcgis-runtime-samples-android

Thanks
Rama

0 Kudos
GeobuzonAplicaciones
New Contributor

can you send the link to that case? (to see the code)

0 Kudos
JarvanMo
New Contributor

Hi @GeobuzonAplicaciones and @RamaChintapalli , I have a 100% case to reproduce this. I have a three tabs, ArcMap tab is at the end of these tabs and ArcMap is put together with other map. I have a switch button to turn on ArcMap visible or invisible. In this case, if I never switch it to ArcMap and ArcMap is never visible to users, then I call  

mapSwitcherRootBinding?.arcMapView?.dispose()

inside 

onDestroyView

 it must crash and this exception is JNI crash and can't be caught in Kotlin side. I think that one possible solution is can we judge if it is rendered or not before dispose ?