Error finding the map with Mapsforge

1

I'm starting to develop an application with mapsforge, I started with the basic example application ( link ).

I am developing with android studio version 1.3.1 and jdk 1.8.0, in windows 7.

I am using the same map that says the example, which I have stored in the phone memory as indicated by the example.

The problem is that when running the application from AS on the phone, it stops its execution and closes. The AS log says it can not find the map, the error is as follows:

E/MapFile﹕ cannot read file: /storage/emulated/0/berlin.map
    org.mapsforge.map.reader.header.MapFileException: cannot read file: /storage/emulated/0/berlin.map
    at org.mapsforge.map.reader.MapFile.<init>(MapFile.java:227)
    at org.mapsforge.map.reader.MapFile.<init>(MapFile.java:205)
    at com.example.luis.mapsforge.MainActivity.onCreate(MainActivity.java:46)
    at android.app.Activity.performCreate(Activity.java:6272)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2387)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2494)
    at android.app.ActivityThread.access$900(ActivityThread.java:157)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1356)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:148)
    at android.app.ActivityThread.main(ActivityThread.java:5530)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:732)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:622)
    
asked by Luis Navarro Arenas 06.07.2016 в 08:14
source

3 answers

0

The problem was caused by the android marshmallow version, to which I had to give permissions on the device.

    
answered by 25.07.2016 / 01:04
source
0

Remember to specify the permissions on your AndroidManifest.xml:

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />  
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> 

But the message that you indicate, I can assure you from experience that you simply can not find the file in the path that shows you error message:

/storage/emulated/0/berlin.map

You must ensure that you have the .map file in the correct path.

    
answered by 07.07.2016 в 13:08
0

the map is not damaged and is on the correct path, in fact check it with an example application that can be downloaded link , permissions on AndroidManifest are correct

    
answered by 10.07.2016 в 03:53