AnsweredAssumed Answered

ArcGISRuntimeException: Cannot call this method in this context when doing exportTile from Android

Question asked by ihazbackup on Oct 9, 2017
Latest reply on Oct 10, 2017 by ANohe-esristaff

Hi,

 

I am currently using the ExportTileCacheTask to export a tpk file from http://services.arcgisonline.com/arcgis/rest/services/World_Street_Map/MapServer

Following the sample: arcgis-runtime-samples-android/export-tiles at master · Esri/arcgis-runtime-samples-android · GitHub 

 

The problem is, it crashes with exception

java.util.concurrent.ExecutionException: com.esri.arcgisruntime.ArcGISRuntimeException: Cannot call this method in this context

The exception is thrown on the line similar to line 211 of the sample

ExportTileCacheParameters parameters = parametersFuture.get();

Here's the full exception log:

10-09 15:50:40.182 12160-12160/package W/System.err: java.util.concurrent.ExecutionException: com.esri.arcgisruntime.ArcGISRuntimeException: Cannot call this method in this context
10-09 15:50:40.182 12160-12160/package W/System.err:     at com.esri.arcgisruntime.internal.a.b.get(SourceFile:128)
10-09 15:50:40.182 12160-12160/package W/System.err:     at de.maengelmelder.mainmodule.activities.MapCachingActivity$doRetrieveMapCache$1.run(MapCachingActivity.kt:184)
10-09 15:50:40.182 12160-12160/package W/System.err:     at android.os.Handler.handleCallback(Handler.java:739)
10-09 15:50:40.182 12160-12160/package W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:95)
10-09 15:50:40.192 12160-12160/package W/System.err:     at android.os.Looper.loop(Looper.java:145)
10-09 15:50:40.192 12160-12160/package W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:5951)
10-09 15:50:40.192 12160-12160/package W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
10-09 15:50:40.192 12160-12160/package W/System.err:     at java.lang.reflect.Method.invoke(Method.java:372)
10-09 15:50:40.192 12160-12160/package W/System.err:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1400)
10-09 15:50:40.192 12160-12160/package W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195)
10-09 15:50:40.192 12160-12160/package W/System.err: Caused by: com.esri.arcgisruntime.ArcGISRuntimeException: Cannot call this method in this context
10-09 15:50:40.192 12160-12160/package W/System.err:     at com.esri.arcgisruntime.internal.a.b.get(SourceFile:120)
10-09 15:50:40.192 12160-12160/package W/System.err:     ... 9 more

 

There's no more indication of the error or the cause of it.

Any possible cause or solution?

 

Thanks before,

Jason

Outcomes