Good afternoon,
We have an app, which uses com.esri.arcgisruntime:arcgis-android:100.15.0. It is published in Google Play.
Google Play console tells that we have quite a lot of crashes here:
Exception com.esri.arcgisruntime.ArcGISRuntimeException: Null pointer.: map_point.get_spatial_reference() at com.esri.arcgisruntime.internal.jni.CoreMapView.nativeLocationToScreen at com.esri.arcgisruntime.internal.jni.CoreMapView.a (SourceFile:8) at com.esri.arcgisruntime.internal.mapping.view.p.a (SourceFile:31) at com.esri.arcgisruntime.mapping.view.MapView.locationToScreen (SourceFile:5) at com.esri.arcgisruntime.mapping.view.Callout$d.onLayout (SourceFile:8) at android.view.View.layout (View.java:24958) at android.view.ViewGroup.layout (ViewGroup.java:6784) at com.esri.arcgisruntime.mapping.view.MapView.onLayout (SourceFile:8) at android.view.View.layout (View.java:24958) at android.view.ViewGroup.layout (ViewGroup.java:6784) at android.widget.FrameLayout.layoutChildren (FrameLayout.java:332) at android.widget.FrameLayout.onLayout (FrameLayout.java:270) at android.view.View.layout (View.java:24958) at android.view.ViewGroup.layout (ViewGroup.java:6784) at android.widget.FrameLayout.layoutChildren (FrameLayout.java:332) at android.widget.FrameLayout.onLayout (FrameLayout.java:270) at android.view.View.layout (View.java:24958) at android.view.ViewGroup.layout (ViewGroup.java:6784) at androidx.drawerlayout.widget.DrawerLayout.onLayout (DrawerLayout.java:1263) at android.view.View.layout (View.java:24958) at android.view.ViewGroup.layout (ViewGroup.java:6784) at android.widget.FrameLayout.layoutChildren (FrameLayout.java:332) at android.widget.FrameLayout.onLayout (FrameLayout.java:270) at android.view.View.layout (View.java:24958) at android.view.ViewGroup.layout (ViewGroup.java:6784) at androidx.appcompat.widget.ActionBarOverlayLayout.onLayout (ActionBarOverlayLayout.java:536) at android.view.View.layout (View.java:24958) at android.view.ViewGroup.layout (ViewGroup.java:6784) at android.widget.FrameLayout.layoutChildren (FrameLayout.java:332) at android.widget.FrameLayout.onLayout (FrameLayout.java:270) at android.view.View.layout (View.java:24958) at android.view.ViewGroup.layout (ViewGroup.java:6784) at android.widget.LinearLayout.setChildFrame (LinearLayout.java:1829) at android.widget.LinearLayout.layoutVertical (LinearLayout.java:1673) at android.widget.LinearLayout.onLayout (LinearLayout.java:1582) at android.view.View.layout (View.java:24958) at android.view.ViewGroup.layout (ViewGroup.java:6784) at android.widget.FrameLayout.layoutChildren (FrameLayout.java:332) at android.widget.FrameLayout.onLayout (FrameLayout.java:270) at com.android.internal.policy.DecorView.onLayout (DecorView.java:1418) at android.view.View.layout (View.java:24958) at android.view.ViewGroup.layout (ViewGroup.java:6784) at android.view.ViewRootImpl.performLayout (ViewRootImpl.java:4787) at android.view.ViewRootImpl.performTraversals (ViewRootImpl.java:4115) at android.view.ViewRootImpl.doTraversal (ViewRootImpl.java:2991) at android.view.ViewRootImpl$TraversalRunnable.run (ViewRootImpl.java:10665) at android.view.Choreographer$CallbackRecord.run (Choreographer.java:1301) at android.view.Choreographer$CallbackRecord.run (Choreographer.java:1309) at android.view.Choreographer.doCallbacks (Choreographer.java:923) at android.view.Choreographer.doFrame (Choreographer.java:852) at android.view.Choreographer$FrameDisplayEventReceiver.run (Choreographer.java:1283) at android.os.Handler.handleCallback (Handler.java:942) at android.os.Handler.dispatchMessage (Handler.java:99) at android.os.Looper.loopOnce (Looper.java:226) at android.os.Looper.loop (Looper.java:313) at android.app.ActivityThread.main (ActivityThread.java:8741) at java.lang.reflect.Method.invoke at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:571) at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1067)
Most of these crashes occur in "POCO vayu" device. Can you elaborate what to do? How to debug that if it happens in some internal SDK module IMHO?
Are you explicitly calling MapView.locationToScreen(Point) MapView (ArcGIS Runtime SDK for Android 100.15.1)? If so, check the point has a spatial reference before calling that method (i.e. spatial reference is not null)
No, I never call it explicitly!
Can you share the code showing how you setup/initialize the mapview, map, and layers?
If you're not calling it explicitly, perhaps somehow locationToScreen is being called internally before the spatial reference for the Map is initialized.
Hmm... I am not sure if I can paste big chunks of my code, but map's initialization looks like this:
var map: ArcGISMap? = null
// ... Some other stuff...
map = ArcGISMap()
val envelope = Envelope(
306520.146,
5973291.05,
680103.277,
6257813.452,
SpatialReference.create(3346)
)
map?.initialViewpoint = Viewpoint(envelope)
map?.minScale = 3000000.0
map?.addDoneLoadingListener {
try {
if (map?.loadStatus == LoadStatus.LOADED) {
mapView?.map = map
mapView?.visibility = View.VISIBLE
// ...
} else {
// ...
}
} catch (e: Exception) {
// ...
}
}
val layer = ArcGISTiledLayer("our_service_url")
layer.addDoneLoadingListener {
map?.basemap?.baseLayers?.add(layer)
if (map?.loadStatus == LoadStatus.NOT_LOADED) {
map?.loadAsync()
}
}
Hi,
From the stacktrace it appears the exception is coming from the Callout code. Internally the Callout does call MapView.locationToScreen. Can you check if the location being set on the Callout has the required spatial reference?
Thanks
Rama
Thanks! I added some "ifs" in my code... If no point or no point's spatial reference -> don't show callout.
It will take some weeks or even months to see if we are rid of this crash 🙂
It is hard to debug our callout as geometry for it is generated from server-side data using Geometry.fromJson().