Home » Android » error handling – Android app won't start noClassDefFoundError

error handling – Android app won't start noClassDefFoundError

Posted by: admin June 15, 2020 Leave a comment

Questions:

I’m creating a gps app for the android! And now I’ve stumbled upon a problem. The app doesn’t start at all… Any ideas of how to fix this?

04-05 12:54:50.877: D/dalvikvm(540): Not late-enabling CheckJNI (already on)
04-05 12:54:51.018: I/dalvikvm(540): Turning on JNI app bug workarounds for target SDK version 5...
04-05 12:54:51.417: I/dalvikvm(540): Could not find method org.acra.ACRA.init, referenced from method com.kulplex.gaia.GaiaApp.onCreate
04-05 12:54:51.417: W/dalvikvm(540): VFY: unable to resolve static method 652: Lorg/acra/ACRA;.init (Landroid/app/Application;)V
04-05 12:54:51.417: D/dalvikvm(540): VFY: replacing opcode 0x71 at 0x0000
04-05 12:54:51.457: D/AndroidRuntime(540): Shutting down VM
04-05 12:54:51.457: W/dalvikvm(540): threadid=1: thread exiting with uncaught exception (group=0x409c01f8)
04-05 12:54:51.477: E/AndroidRuntime(540): FATAL EXCEPTION: main
04-05 12:54:51.477: E/AndroidRuntime(540): java.lang.NoClassDefFoundError: org.acra.ACRA
04-05 12:54:51.477: E/AndroidRuntime(540):  at com.kulplex.gaia.GaiaApp.onCreate(GaiaApp.java:54)
04-05 12:54:51.477: E/AndroidRuntime(540):  at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:969)
04-05 12:54:51.477: E/AndroidRuntime(540):  at android.app.ActivityThread.handleBindApplication(ActivityThread.java:3954)
04-05 12:54:51.477: E/AndroidRuntime(540):  at android.app.ActivityThread.access$1300(ActivityThread.java:123)
04-05 12:54:51.477: E/AndroidRuntime(540):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1185)
04-05 12:54:51.477: E/AndroidRuntime(540):  at android.os.Handler.dispatchMessage(Handler.java:99)
04-05 12:54:51.477: E/AndroidRuntime(540):  at android.os.Looper.loop(Looper.java:137)
04-05 12:54:51.477: E/AndroidRuntime(540):  at android.app.ActivityThread.main(ActivityThread.java:4424)
04-05 12:54:51.477: E/AndroidRuntime(540):  at java.lang.reflect.Method.invokeNative(Native Method)
04-05 12:54:51.477: E/AndroidRuntime(540):  at java.lang.reflect.Method.invoke(Method.java:511)
04-05 12:54:51.477: E/AndroidRuntime(540):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
04-05 12:54:51.477: E/AndroidRuntime(540):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
04-05 12:54:51.477: E/AndroidRuntime(540):  at dalvik.system.NativeStart.main(Native Method)
How to&Answers:

If you’ve recently updated to ADT 17 and above, they’ve changed the lib library handling.

so you need to rename your lib dir to libs,
then right click your project > properties > Java build path > Libraries > select all the jars with error markings on them and click remove > click add JARs > select all jars from your new libs dir.

Hope this helps.

Answer:

I had this same issue after updating to the latest Android tools.

In the project properties, Java Build Path, Order and Export section, I had to make sure the Android Private Libraries was checked.

Then I had to clean the project. After that it seems to work.

It was indeed an issue with ‘Order and Export’ of the Java Build Path.

When upgrading, the ‘Order and Export’ of the new ‘Android Private Libraries’ is not always checked. And the android-support-v4.jar is now in this ‘Android Private Libraries’ section.

To fix this, go to ‘Order and Export’ and check ‘Android Private Libraries’. Then refresh/clean/rebuild.

After you done this ‘fix’ for a library project, you may need to just close and re-open any depending project, because they may not see this ‘fix’ immediately.

I found the answer here.