What is the correct maven repo for 0.9-snapshot?

hi
in the readme of mapmatching it says

com.graphhopper
map-matching

0.8.2

so I would like to add the 0.9-SNAPSHOT version to my android project, however, the latest version on maven is 0.7

adding that one to my project, with
compile(group: ‘com.graphhopper’, name: ‘graphhopper-core’, version: ‘0.9-SNAPSHOT’) {

is not accepted by Android Studio. I must be doing something wrong here, but cannot figure out what it is?

thanks

On Android you need to enable something so that it works for snapshots. I think it was:

configurations.all {
    // check for updates every build
    resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}

Don’t forget to add first the snapshots repository:

repositories {
    maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}
1 Like

in gradle script of project:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
_ repositories {_
_ jcenter()_
_ mavenCentral()_
_ }_
_ dependencies {_
_ classpath ‘com.android.tools.build:gradle:2.2.2’_
_ }_

}

allprojects {
_ repositories {_
_ jcenter()_
_ maven { url “https://oss.sonatype.org/content/groups/public/” }_
_ }_
}

in app gradle script:
/** only necessary if you need to use latest SNAPSHOT**/
configurations.all {// check for updates every build
resolutionStrategy.cacheChangingModulesFor 0, ‘seconds’}

repositories {
jcenter()
mavenCentral()

repositories {
    maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}

}

dependencies {
compile(group: ‘com.graphhopper’, name: ‘graphhopper-core’, version: ‘0.9-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’
}

compile 'com.graphhopper:map-matching:0.9-SNAPSHOT'

compile 'org.mapsforge:vtm-android:0.6.0:natives-armeabi'
compile 'org.mapsforge:vtm-android:0.6.0:natives-armeabi-v7a'
compile 'org.mapsforge:vtm-android:0.6.0:natives-x86'

compile 'org.mapsforge:vtm:0.6.0'
compile 'org.mapsforge:vtm-android:0.6.0'
compile 'org.mapsforge:vtm-jts:0.6.0'
compile 'org.mapsforge:vtm-themes:0.6.0'
compile 'com.caverock:androidsvg:1.2.2-beta-1'
compile 'com.vividsolutions:jts:1.13'
compile 'org.slf4j:slf4j-api:1.7.21'
compile 'org.slf4j:slf4j-android:1.7.21'
compile 'com.android.support:support-v4:25.0.1'

}

I keep getting this error:
Error:(49, 13) Failed to resolve: com.graphhopper:map-matching:0.9-SNAPSHOT
Show in File
Show in Project Structure dialog

It must be something simple, right? as I’m mainly following the sample code provided for mapsforge with graphhopper.

thanks in advance!

The dependency is a new one: graphhopper-map-matching-core not graphhopper-map-matching

Could you try with:

compile 'com.graphhopper:graphhopper-map-matching-core:0.9-SNAPSHOT'

well, that actually did something :slight_smile:

now I get this error:
Error:Failed to resolve: com.graphhopper.external:hmm-lib:1.0.0-SNAPSHOT
Open File
Show in Project Structure dialog

I’ve deployed a 0.9-SNAPSHOT version again as the latest master should link to hmm-lib 1.0.0

https://oss.sonatype.org/content/groups/public/com/graphhopper/external/hmm-lib/1.0.0/

Again, somethng new is happening, but not sure anymore how to solve it:

Error:Execution failed for task ‘:app:transformResourcesWithMergeJavaResForDebug’.
> com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/LICENSE
_ File1: C:…gradle\caches\modules-2\files-2.1\log4j\log4j\1.2.17\5af35056b4d257e4b64b9e8069c0746e8b08629f\log4j-1.2.17.jar_
_ File2: C:…gradle\caches\modules-2\files-2.1\org.apache.xmlgraphics\xmlgraphics-commons\2.1\b61132defe1df4e91c1eb0ddf544958c50d358b5\xmlgraphics-commons-2.1.jar_

Also, the GPXFile.java has a lot of unresolved symbols error messages. The map matching imports are not working anymore since this line was changed:
compile ‘com.graphhopper:graphhopper-map-matching-core:0.9-SNAPSHOT’

well, I think I solved it:

I used these repo’s and dependencies:

maven { url “https://oss.sonatype.org/content/repositories/snapshots/com/graphhopper/” }
compile ‘com.graphhopper:graphhopper-map-matching-core:0.9-SNAPSHOT’

and added this to the app gradle script. Just some errors when running on the emulator, but at least it is running again.

packagingOptions {
_ exclude ‘META-INF/NOTICE.txt’_
_ exclude ‘META-INF/NOTICE’ _
_ exclude ‘META-INF/LICENSE’ _
_ exclude ‘META-INF/notice’_
_ exclude ‘META-INF/notice.txt’_
_ exclude ‘META-INF/license’_
_ exclude ‘META-INF/license.txt’_
}

Consider excluding any transitive dependencies from some libraries, which can load unnecessarily the app.
Above I see the xmlgraphics-commons which is not needed in client and probably picked from map-matching.

You can do that either globally:

configurations.all {
    transitive = false
}

Or per dependency like seen in Android sample here.

strange thing is that this was already exclused. This came with the android sample app. But is it working for now. Getting rid of the remaining error messages will be something for the future.

compile(group: ‘com.graphhopper’, name: ‘graphhopper-core’, version: ‘0.9-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’

Android sample uses only graphhopper-core, but you added also map-matching which uses graphhopper itself, so the dependencies are picked from it too.

1 Like