GH 0.7.0 Android jars dependencies issue on eclipse ADT

Hello,

I worked on GH 0.5.0 for Android OS using “graphhopper-0.5-SNAPSHOT-android.jar” which includes “gh core” + slf4j + trove4j. Everything worked fine.

Now I’m trying to move to GH 0.7 with updated jar dependencies for Android. When I use Android Studio on gh Android example (GH + MapsForge), it works fine but when I use eclipse ADT, compilation is OK but at run time, I get: "Could not find class ‘com.graphhopper.GraphHopper’. I tried several jar dependencies but GH classes are always not found at run time, my jar are:

  • graphhopper-0.7.0.jar
  • slf4j-android-1.7.7.jar
  • slf4j-api-1.7.7.jar
  • trove4j-3.0.3.jar

So my question is : eclipse ADT still working for GH 0.7.0 ? Is there any restriction/limitation?

Regards,
Martin

Why not use Eclipse with the maven plugin? Then there won’t be (shouldn’t be) dependencies issues. (But I cannot really help as I have a bad relationship with Eclipse :wink: and no real experience with it)

What Eclipse, Neon with Android Andmore?

Have you tested the jars with Android Studio?

Like @karussell mentioned Eclipse supports Maven for convenience, and Gradle of course.

1 Like

Thank you for your answers. I’m using Eclipse 4.2.1 with ADT plugin for Eclipse (22.6.2).

I started with Android Studio as mentionned in the graphhopper documentation and I was able to load correctly the example android application (mapsforge + gh 0.7) to Android emulator. Then, I copied all 13 jars (dependencies) generated by Android Studio to my android project from the eclipse environment (libs/ directory). From Eclipse, compilation is fine but at runtime, the android application crashes : Could not find class ‘com.graphhopper.GraphHopper’. Apparently the link between jars in Android project failed.

Is it a way that should work : copying jar files from Android Studio to another IDE may be not suitable?

It is highly recommended to use a build tool like maven or gradle as mentioned @devemux86. Because there will be changes and updates that will cause you pain.

Ok thank you for the advice, you’re right.

By the way, my problem comes from java version : GH moved to version 7 and jar files from eclipse ADT needs jar compiled with java version 6, it caused the crash.

As announced you need Java 7 now.

Also it’d be good to advance to latest versions of the IDE + plugin.