AnsweredAssumed Answered

Loading MapView from WebMap loaded by webmap.json

Question asked by Valex_Savino on Nov 27, 2015
Latest reply on Mar 28, 2016 by WCrick-esristaff

Hello,

I tried to load a MapView using a WebMap. The WebMap is loaded from a json downloaded by Collector. This is my code:

 

First, I load the JsonParser that load the webmap.json

 

JsonFactory factory = new JsonFactory();

JsonParser parser = factory.createJsonParser(new FileInputStream(Constants.JSON_WEBMAP_PATH));

 

then I get an Evelop (called "extent") and a SpatialReference (called "sp").

 

Whit this values, load the webmap

 

webMap = WebMap.newInstance(parser, extent, sp);

 

and then, load the map

 

map = new MapView(MyActivity.this, webMap, null, null);

 

After this, I got this two errors:

 

11-27 13:00:12.460 5388-5678/com.esri.android.test.esrimasktest E/ArcGIS: Failed to check the service owning system URL

            java.lang.NullPointerException

            at com.esri.android.map.b$a.onWebMapLoadError(SourceFile:856)

            at com.esri.android.map.a.a(SourceFile:77)

            at com.esri.android.map.a.a(SourceFile:117)

            at com.esri.android.map.b.loadServiceInfo(SourceFile:237)

            at com.esri.android.map.Layer.loadServiceInfo(SourceFile:219)

            at com.esri.android.map.ags.ArcGISFeatureLayer.initLayer(SourceFile:983)

            at com.esri.android.map.Layer$2.run(SourceFile:253)

            at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)

            at java.util.concurrent.FutureTask.run(FutureTask.java:237)

            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)

            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)

            at java.lang.Thread.run(Thread.java:841)

11-27 13:00:12.460 5388-5678/com.esri.android.test.esrimasktest E/ArcGIS: Failed to initialize the ArcGISFeatureLayer.

            java.lang.Exception: Failed to retrieve layer info.

            at com.esri.android.map.ags.ArcGISFeatureLayer.initLayer(SourceFile:987)

            at com.esri.android.map.Layer$2.run(SourceFile:253)

            at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)

            at java.util.concurrent.FutureTask.run(FutureTask.java:237)

            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)

            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)

            at java.lang.Thread.run(Thread.java:841)

 

Any ideas to resolve? Thanks to all!

Outcomes