android : NoClassDefFoundError for android 4.4 and below

只谈情不闲聊 提交于 2019-12-24 18:00:30

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!