when i try to load ArcGISLocalTiledLayer, i have this error. I try with different TPK, owns, and th esri.
Thanks in advanced.
E/ArcGIS: url =file:///mnt/sdcard/AndroidNavColombia/Tiles/SanFrancisco.tpk java.lang.RuntimeException: Internal error exception - Failed to open file. May not be a valid tile package.
at com.esri.android.map.ags.ArcGISLocalTiledLayer.nativeInitialize(Native Method)
at com.esri.android.map.ags.ArcGISLocalTiledLayer.initLayer(SourceFile:118)
at com.esri.android.map.ags.ArcGISLocalTiledLayer.<init>(SourceFile:82)
at com.esri.android.map.ags.ArcGISLocalTiledLayer.<init>(SourceFile:69)
at com.navcolombia.co.myapplication.MainActivity.onCreate(MainActivity.java:34)
at android.app.Activity.performCreate(Activity.java:6876)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1135)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3206)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3349)
at android.app.ActivityThread.access$1100(ActivityThread.java:221)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7224)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Can you confirm that the TPK exists on the device?
I would use the File.exists() method to confirm it is on the device at that location:
Alexander thanks for your answer,
Yes, i use File to check if File.exists(), i don't know was the problem,
my solution was back to android 22 and it work; the problem is with android 23.
If you are having issues at API version 23 it sounds like you are not giving permission to "dangerous" permissions.
This link should explain dangerous permissions:
System Permissions | Android Developers
This link would show how to request the permissions at runtime for external storage which would circumvent a possible dangerous permissions error:
android - Storage permission error in Marshmallow - Stack Overflow
Does this help?