Android java.lang.NoClassDefFoundError

I have an Android project in the Eclipse IDE that worked. After some import and tests, I get the error message: java.lang.NoClassDefFoundError .

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

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

Here is 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 a solution to my problem:

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

+54
android noclassdeffounderror
Mar 26 2018-12-12T00:
source share
8 answers

Have you recently updated the eclipse android plugin (adt r17)? Then the following link may help:

How to fix classdefnotfounderror using adt-17

Update: A year has passed since the question arose. I will keep the link because even in 2013 it helps some people to solve this problem. But please take care of what you do, see Erica's Comment below. The current version of ADT is 22, I recommend using the latest version.

+55
Mar 26 '12 at 11:14
source share
โ€” -

Edit the build path in this order, it worked for me.

Make sure /gen is before /src

enter image description here

+27
Jul 20 '13 at 7:20
source share

I fixed the problem by simply adding the private libraries of the main project to it:

 Project Properties->Java Build Path->Order And Export 

And make sure Android Private Libraries are checked.

Screenshot:

enter image description here

Make sure google-play-services_lib.jar and google-play-services.jar . Clean up the project and run it, and the classNotfound exception will disappear.

+17
Jun 20 '13 at 19:12
source share

Imaage

Go to the section "Ordering and exporting from project properties" and make sure that you include the necessary banks in the export, this did it for me

+1
Jul 02 '13 at 11:15
source share

I came across this problem several times, opening old projects that include other Android libraries. What works for me:

Move Android to the top of the Order & Export tab and deselect.

Yes, that really matters. Maybe I should cut ADT for Android Studio!

+1
Aug 19 '13 at 22:59 on
source share

You can also get this error if you try to enable a jar that was compiled with jdk 1.7 instead of 1.6.

In my case, I realized this by trying to package my application using Ant scripts provided by the SDK instead of ADT, and I noticed these errors that ADT did not show me:

  [dex] Pre-Dexing libjingle_peerconnection.jar -> libjingle_peerconnection-2f82c9bf868a6c58eaf2c3b2fe6a09f3.jar [dx] [dx] trouble processing: [dx] bad class file magic (cafebabe) or version (0033.0000) [dx] ...while parsing org/webrtc/StatsReport$Value.class [dx] ...while processing org/webrtc/StatsReport$Value.class 

I recompiled my jar using jdk 1.6 and fixed a bug.

+1
Dec 13 '13 at 6:08
source share

Try Project -> Properties -> Java Build Path -> Order & Export And Confirm Android private libraries are checked for your project and for all other library projects that you use in your application.

+1
Apr 16 '15 at 12:28
source share

After checking the Java build path, then add the lines of code to the manifest file.

 <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> 
0
Aug 26 '15 at 11:29
source share



All Articles