graphhopper: Building Android package via maven fails
It seems that since the update to mapsforge/vtm 0.8.0 we can no longer build the Android demo (at least via maven). The problem is the class clash of two different jts jars: one older 1.13 (from gh-core) and the 1.14 jts-core
from mapsforge vtm-jts
- see this change.
The cleanest way would be to upgrade to 1.14 for gh-core. @michaz what blocking issues are there to do so? I remember it was GeoJSON related but as mapsforge does also related stuff - maybe @devemux86 can help?
- fix dep problem or workaround the issue for now via some dep exclusion
- the NetBeans graph dependency viewer shows a clash for
slf4j-api
: 1.7.12 vs. 1.7.21 … In GH we usually use 1.7.25 and now there is also a more recentslf4j-android
so we should be able to update this.
BTW: The error message when executing mvn -P include-android -DskipTests=true clean install
was a bit cryptic:
[ERROR] Failed to execute goal com.simpligility.maven.plugins:android-maven-plugin:4.4.3:dex (default-dex) on project graphhopper-android: : MojoExecutionException: ANDROID-040-001: Could not execute: Command = ...
Executing the listed command showed me the problem:
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/vividsolutions/jts/JTSVersion;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/vividsolutions/jts/algorithm/Angle;
...
Excluding one or the other jts library does not fix the problem or causes others.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 23 (23 by maintainers)
Commits related to this issue
- fixed build issue with android, #1144 — committed to graphhopper/graphhopper by karussell 7 years ago
- android: minor dependency improvement after #1144 — committed to graphhopper/graphhopper by karussell 7 years ago
- Switch to jts-core 1.14.0, exclude jts 1.13 from dependencies. #1144 — committed to graphhopper/graphhopper by michaz 7 years ago
Thanks!
It looks like 1.15 is around the corner (see slide 5 here) and if that will be the case I’ll ask/help those dependencies to upgrade so we reduce potential license problems when using GH in iOS or Android (due to the LGPL).
My local builds work, can you try:
The issue is that two other dependencies (gtfs-lib, and, more importantly, the Jackson bindings for JTS) declare JTS 1.13, which in itself is not a problem, but they switched from one jar to several jars between them (jts -> jts-core, … ), which means that Maven doesn’t know that one supersedes the other.
So I updated to jts-core 1.14.0 now and manually excluded the monolithic JTS from the dependencies.
This means that only tests can prevent ClassNotFoundExceptions in case one of the dependencies tries to use something which is in jts but not in jts-core. :-}
But should be fine.
And graphhopper-core gets a bit smaller.
That’s very strange, working with 26.0.1 from its start without issues… Of course with all environment aligned, Android Studio 2.3.3, Gradle 3.3, Android plugin 2.3.3, Android SDK 26 (fully updated), etc.