D-Dᴙum
D-Dᴙum

Reputation: 7890

Creating an External JAR Targeting JDK 1.7 Results in NoClassDefFoundError at Runtime

I've created a small JAR library in Netbeans containing a few non-platform specific classes and interfaces. I then use this JAR file in an Android Eclipse project by placing it in the libs folder. I can then import any class or interface into the android code with no problem. I can also extend the Android View class and implement an interface contained with the JAR file and this custom View is displayed in the Layout editor (in Eclipse) with no problem.

The problem comes when I attempt to run the app on the Emulator. It crashes and logcat gives a NoClassDefFoundError, complaining that it cannot resolve classes which are in the JAR file despite me including it in the build path.

I originally built the JAR file targeting JDK 1.7 but I happened to try changing it to JDK 1.6 and then the app works.

Has anyone else come across this? Is JDK 1.7 incompatible with Android?

javac -version reports 1.7.0_17

Upvotes: 0

Views: 188

Answers (2)

D-Dᴙum
D-Dᴙum

Reputation: 7890

Looks as though JDK 1.6 is required for compiling though the tools themselves (i.e. Eclipse) run OK on 1.7, as indicated here.

Upvotes: 0

silentnuke
silentnuke

Reputation: 2622

Android dosen't support JDK 1.7

Upvotes: 1

Related Questions