问题
My app gives NoClassDefFoundError
for versions of sdk 19 or below.
I had in my gradle
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.idg.mail"
minSdkVersion 14
targetSdkVersion 23
multiDexEnabled = true
}
Now i tried to change it to
compileSdkVersion 19
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.idg.gatcamail"
minSdkVersion 19
targetSdkVersion 19
multiDexEnabled = true
}
i changed in app-> module settings - android - sdk
as well.
With these changes i built the project but still it gives same error on my android 4.4
and it runs on higher versions.
The class is a class defined in the code where i handle network operations.
How can i do the debugging of this issue
回答1:
I'm almost sure that it is multidex issue. If it's running properly on sdk 21 - it's multidex issue.
Here is official info: Multidex
If you're using custom implementation of Application class, it has to extend MultiDexApplication class. Also there is gradle flag required. If you're not using custom Application class, just add entry provided in your manifest - it's described in documentation.
Edit: Almost forgot - you've to add dependency, multidex is provided with this library: compile 'com.android.support:multidex:1.0.1'
来源:https://stackoverflow.com/questions/36889914/android-noclassdeffounderror-for-android-4-4-and-below