I've got an Android application that I recently upgraded to the Gradle build system among other things, such as using a newer version of build tools, etc.
My targetSdkVersion is 19, so I should be good to go on Android 4.4 and higher. When I run using a 5.0+ device, all is well; however Android 4.4 always crashes with a java.lang.NoClassDefFoundError
error of some sort.
As a test, I removed original class that it complained about missing only to have it crash while pointing at a different class.
The first class that it crashed on was an internal private class in a 3rd party library. After removing that library, it pointed to a internal private class in the app itself.
In summary:
java.lang.NoClassDefFoundError
on anything less than 5.0. Here's my android.manifest file: https://gist.github.com/rscott78/19dd88ccde66172d9332
For what it's worth, this can happen when you enable multi-dex support without adding the correct code in your Application class.
Create a class, have it inherit from Application, then add this override:
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
In your AndroidManifest, add a name
attribute to your application tag:
<application name=".MyApplication"
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