GraphHopper.com | Forum | GitHub | Maps | Blog

Graphhopper Android graphhopper.load error


#1

Yesterday I’ve made an Android Studio project with graphhopper. I’ve made import osm data:
$ ./graphhopper.sh -a import -i d:/maps/central.osm.pbf -c config.yml
then copy generated files to Android device.
In code I used:
graphHopper.load(Environment.getExternalStorageDirectory().absolutePath + “/map”)
/map - is a directory with generated graphhopper files after import

And it was all working fine till today. Today this code not working. I didn’t make any changes to project with graphhopper, but after several app launches I got error while graphhopper.load():

java.lang.StringIndexOutOfBoundsException: length=0; regionStart=1; regionLength=-2

I use library ‘com.graphhopper:graphhopper-core:0.12-SNAPSHOT’:

implementation(‘com.graphhopper:graphhopper-core:0.12-SNAPSHOT’) {
exclude group: ‘com.google.protobuf’, module: ‘protobuf-java’
exclude group: ‘org.openstreetmap.osmosis’, module: ‘osmosis-osm-binary’
exclude group: ‘org.apache.xmlgraphics’, module: ‘xmlgraphics-commons’
}

P.S. And demo Android Studio project from https://github.com/graphhopper/graphhopper/tree/master/android
also doesn’t work with the same error.

But interesting thing is that this apk works fine - https://graphhopper.com/public/releases/graphhopper-android-0.11.0.apk

What to do?


#2

I don’t know if this is right solution, but I found that with ‘com.graphhopper:graphhopper-core:0.11.0’ graphhopper.load works fine.