Skip to content Skip to sidebar Skip to footer

Noclassdeffounderror - Android 2.3.x

I have a Task defined in a class. Fatal exception 'NoClassDefFoundError' is happening on following line MyCuteTask myTask = new MyCuteTask(equations) Here is the code public clas

Solution 1:

Its an google play services issue. (https://code.google.com/p/android/issues/detail?id=81083)

Workaround to avoid this crash till Google fixes it:

Add following into your Application#onCreate() method

try {
  Class.forName("android.os.AsyncTask");
}
catch(Throwable ignore) {
  // ignored
}

Note its Application#onCreate() and not Activity#onCreate()

Update: I can verify that above changes fixed these crashes for me.

Solution 2:

Asynctask was added in API level 3. Please verify one by checking the same code with API 3. If it disappears, there is your problem

Solution 3:

This is an inner class please refer how to access the inner class object through outerclass else define your Myclass outside the Mainclass

Solution 4:

I reported the same error here: Android: NoClassDefFoundError android.os.AsyncTask Because it started happening without any app delivery it looks like yet another Google Play Services bug... I'm having 83% of crashes on Android 2.3.x and 16% on crashes on 4.0.3 & 4.0.4

Solution 5:

I had the same problem and I have copied source code of the AsyncTask as MyAsyncTask into my project and extended from that class, now it works.

Post a Comment for "Noclassdeffounderror - Android 2.3.x"