Android java.lang.NoClassDefFoundError

Miloš picture Miloš · Mar 26, 2012 · Viewed 113.5k times · Source

I have an Android project in eclipse IDE which was working. After some imports and tests, I get the error: java.lang.NoClassDefFoundError.

In my project I have two packages: the main one and the second one with some classes.

When I try to instantiate an object from the second package class in the main activity class, I am getting this error.

Here is the logcat:

FATAL EXCEPTION: main
java.lang.NoClassDefFoundError: com.neurospeech.wsclient.MDPIforEditorialBoard
at milos.mdpi.Journals.<init>(Journals.java:41)
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1409)
at android.app.Instrumentation.newActivity(Instrumentation.java:1040)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1777)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1893)
at android.app.ActivityThread.access$1500(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1054)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:150)
at android.app.ActivityThread.main(ActivityThread.java:4389)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:849)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:607)
at dalvik.system.NativeStart.main(Native Method)

Found the solution to my problem:

The solution can be found here: http://android.foxykeep.com/dev/how-to-fix-the-classdefnotfounderror-with-adt-17

Answer

Minsky picture Minsky · Mar 26, 2012

Did you recently updated your eclipse android plugin (adt r17)? Then the following link might help:

How to fix the classdefnotfounderror with adt-17

Update: One year has passed since the question arose. I will keep the link, because even in 2013 it seem to help some people to solve the problem. But please take care what you are doing, see Erics comment below. Current ADT-Version is 22, I recommend using the most current version.