I’m working on a small android-based project (I’m pretty new to the system). When I run the code on an Android emulator it crashes and I get the noClassDefFoundError. The .jar I’m trying to import is a very simple class written as a Java project. The error is not Android dependencies or ‘lib/libs’.
The .jars (which I’m importing from the dropboxAPI) are working just fine (after getting the dependencies straight) but the same fix does not work for my .jar.
Does anyone know what i’m doing wrong?
// S verker
[2012-11-22 20:25:58 - DropDoList] Android Launch!
[2012-11-22 20:25:58 - DropDoList] adb is running normally.
[2012-11-22 20:25:58 - DropDoList] Performing com.example.dropdolist.DropDoList activity launch
[2012-11-22 20:25:58 - DropDoList] Automatic Target Mode: using existing emulator 'emulator-5554' running compatible AVD 'Galaxy2v3'
[2012-11-22 20:25:58 - DropDoList] WARNING: Application does not specify an API level requirement!
[2012-11-22 20:25:58 - DropDoList] Device API version is 16 (Android 4.1.2)
[2012-11-22 20:25:58 - DropDoList] Uploading DropDoList.apk onto device 'emulator-5554'
[2012-11-22 20:26:02 - DropDoList] Installing DropDoList.apk...
[2012-11-22 20:26:11 - DropDoList] Success!
[2012-11-22 20:26:11 - DropDoList] Starting activity com.example.dropdolist.DropDoList on device emulator-5554
[2012-11-22 20:26:12 - DropDoList] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.dropdolist/.DropDoList }
[2012-11-22 20:41:10 - DropDoList] Dx
trouble processing:
[2012-11-22 20:41:10 - DropDoList] Dx bad class file magic (cafebabe) or version (0033.0000)
...while parsing Tester/Transaction.class
...while processing Tester/Transaction.class
[2012-11-22 20:41:10 - DropDoList] Dx
trouble processing:
[2012-11-22 20:41:10 - DropDoList] Dx bad class file magic (cafebabe) or version (0033.0000)
...while parsing test/Tester.class
...while processing test/Tester.class
[2012-11-22 20:41:10 - DropDoList] Dx 2 warnings
You’re getting a
Dx bad class file magic (cafebabe) or versionfor two of your classes. This error will not stop the build process. Instead, it will silently exclude these files from the final compiled apk.You will get this error if you are using (say) Java 5 and you are using a JAR compiled with Java 6.
The easiest way to resolve is to upgrade your version of Java to the one used by the JAR. You can change the version use for building by going to
Project -> Properties -> Java Compilerand checking theEnable project specific settingsbox and changing theCompiler compliance level:value.Android Tools don’t play nice with Java 7, and you get a ton of
@Overrideerrors when using Java 5, so I’d recommend using Java 6 (which would be 1.6 in the compiler compliance dropdown). You may have to install it anew if it isn’t already present.