0

My map is working fine with offline, i downloaded the .pbf file from geofabrik when i run find routes then i got the following error. i used graphhopper for offline routing.

8-15 23:19:03.393 19815-19880/com.github.lassana.offlineroutingsample E/AndroidRuntime: FATAL EXCEPTION: ModernAsyncTask #1 Process: com.github.lassana.offlineroutingsample, PID: 19815 java.lang.RuntimeException: An error occured while executing doInBackground() at android.support.v4.content.ModernAsyncTask$3.done(ModernAsyncTask.java:137) at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355) at java.util.concurrent.FutureTask.setException(FutureTask.java:222) at java.util.concurrent.FutureTask.run(FutureTask.java:242) 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:818) Caused by: java.lang.IllegalStateException: Version of nodes unsupported: 5, expected:3 at com.graphhopper.storage.StorableProperties.check(StorableProperties.java:183) at com.graphhopper.storage.StorableProperties.checkVersions(StorableProperties.java:151) at com.graphhopper.storage.GraphHopperStorage.loadExisting(GraphHopperStorage.java:1374) at com.graphhopper.GraphHopper.load(GraphHopper.java:679) at com.graphhopper.GraphHopper.importOrLoad(GraphHopper.java:557) at com.github.lassana.offlineroutingsample.map.routing.RouteLoader.loadInBackground(RouteLoader.java:83) at com.github.lassana.offlineroutingsample.map.routing.RouteLoader.loadInBackground(RouteLoader.java:29) at android.support.v4.content.AsyncTaskLoader.onLoadInBackground(AsyncTaskLoader.java:242) at android.support.v4.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:51) at android.support.v4.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:40) at android.support.v4.content.ModernAsyncTask$2.call(ModernAsyncTask.java:123) 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:818)

I thought i need to update the graphhopper to 0.5 and make a change in gradle file

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:22.0.0'
//    compile project(':graphhopper-wrapper')
    // https://mvnrepository.com/artifact/com.graphhopper/graphhopper-android
    compile group: 'com.graphhopper', name: 'graphhopper-android', version: '0.5.0'

    compile 'com.squareup:otto:1.3.6'
    compile 'com.squareup.okhttp:okhttp:2.3.0'
    compile 'org.osmdroid:osmdroid-android:4.2'
//    compile 'org.mapsforge:mapsforge-core:0.4.3'
    compile 'org.mapsforge:mapsforge-core:0.5.1'
//    compile 'org.mapsforge:mapsforge-map:0.4.3'
    compile 'org.mapsforge:mapsforge-map:0.5.1'
//    compile 'org.mapsforge:mapsforge-map-android:0.4.3'
    compile 'org.mapsforge:mapsforge-map-android:0.5.1'
//    compile 'org.mapsforge:mapsforge-map-reader:0.4.3'
    compile 'org.mapsforge:mapsforge-map-reader:0.5.1'
//    compile 'org.slf4j:slf4j-android:1.7.7'
    compile 'org.slf4j:slf4j-android:1.7.12'
    compile 'com.google.android.gms:play-services:7.3.0'
}

when i sync gradle i got this

Error:Dependency com.graphhopper:graphhopper-android:0.5.0 on project app resolves to an APK archive which is not supported as a compilation dependency. File: /home/yubraj/.gradle/caches/modules-2/files-2.1/com.graphhopper/graphhopper-android/0.5.0/7c94e4d4c62ada47559bc8b907e7f30d8852fe68/graphhopper-android-0.5.0.apk

any fixes for this ? Thanks in advance.

Karussell
  • 17,085
  • 16
  • 97
  • 197
yubaraj poudel
  • 3,821
  • 1
  • 31
  • 28

1 Answers1

1

The question does not really contain a clear question, so I'll pick the error message in the header: 'Version of nodes unsupported: X, expected: Y'

To fix that you need to use the same GraphHopper version for the creation of the files (./graphhopper.sh import your.pbf) like you use for reading them. I recommend to use the latest version for import (currently 0.7.0) and also use this for your Android dependency.

Regarding the gradle error I have no idea.

Karussell
  • 17,085
  • 16
  • 97
  • 197
  • I'm using `implementation(group: 'com.graphhopper', name: 'graphhopper-core', version: '0.8-SNAPSHOT')` as my gradle dependency and download the source code of branch 0.8 and created the route data but I'm still getting this error. Please guide what's the correct way to know the source of the jar version. – Muhammad Babar Dec 07 '19 at 21:36