Since November 21, 2014 I am receiving hundreds of crash reports with the stack below.
The crash occurs only on API Level 10 devices (the app supports 9+)
The very same version of the app had been running fine over several weeks before the crashes started. This makes me think that the problem is caused by some over-the-air update that was pushed to Android 2.3 devices recently.
I use AdMob mediation (which is now part of the Google Play Services library) and several other ad network SDKs in my app.
I suspect the Google Play Services library to be causing the crash, as it is the only part of the app that, to my knowledge, is likely to be updated over-the-air (and this would not be the first time a buggy update causes crashes).
Is it possible, as mentioned by the OPs answer here, that an uncaught exception triggered inside the thread created by AdMob to display banner ads might put the whole process in a state where it is not able to create new instances of classes anymore?
Has anybody been suffering from a similar issue recently?
java.lang.NoClassDefFoundError: com.myapp.MyClassExtendingAsyncTask
at com.myapp.x.run(SourceFile:417)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3859)
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:889)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:647)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: com.myapp.MyClassExtendingAsyncTask in loader dalvik.system.PathClassLoader[/data/app/com.myapp-1.apk]
at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
... 10 more
OK, looks like it is a problem with one of the versions of Google play Services. See https://code.google.com/p/android/issues/detail?id=81083
Looks like a work around might be to add the following to your Application#onCreate()
:
package acme.com.myAppName;
import android.app.Application;
public class MyApplication extends Application
{
@Override
public void onCreate()
{
// begin add
try {
Class.forName("android.os.AsyncTask");
} catch(Throwable ignore) {
}
// end add
super.onCreate();
}
}
NB don't forget to configure your Application class in your AndroidManifest.xml
(if you haven't already).
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme"
android:name="acme.com.myAppName.MyApplication" >
...
</application>
To expand on the answer above, as I didn't know what the Application#onCreate() was and hadn't already implement one in my app. What I did was create a new Class in my app with the following:
package acme.com.myAppName;
import android.app.Application;
public class myApplication extends Application
{
@Override
public void onCreate()
{
try
{
Class.forName("android.os.AsyncTask");
}
catch(Throwable ignore){}
super.onCreate();
}
}
Then I updated my AndroidManifest.xml file with android:name="acme.com.myAppName.myApplication"
to use the myApplication
class, like so:
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme"
android:name="acme.com.myAppName.myApplication" >
...
</application>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With