android : NoClassDefFoundError for android 4. 4及以下

标签 android noclassdeffounderror android-4.4-kitkat

我的应用程序为 sdk 19 或更低版本提供 NoClassDefFoundError。 我在我的毕业典礼上

 android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"
    defaultConfig {
        applicationId "com.idg.mail"
        minSdkVersion 14
        targetSdkVersion 23
        multiDexEnabled = true
    }

现在我试着把它改成

compileSdkVersion 19
    buildToolsVersion "23.0.1"
    defaultConfig {
        applicationId "com.idg.gatcamail"
        minSdkVersion 19
        targetSdkVersion 19
        multiDexEnabled = true
    }

我也在 app-> module settings - android - sdk 中进行了更改。 通过这些更改,我构建了项目,但它仍然在我的 android 4.4 上出现相同的错误,并且它在更高版本上运行。

该类是在我处理网络操作的代码中定义的类。

如何调试这个问题

最佳答案

我几乎可以肯定这是 multidex 问题。如果它在 sdk 21 上正常运行 - 这是 multidex 问题。

这是官方信息:Multidex

如果您使用 Application 类的自定义实现,它必须扩展 MultiDexApplication 类。还需要 gradle 标志。如果您不使用自定义应用程序类,只需添加 list 中提供的条目 - 文档中对此进行了描述。

编辑:差点忘了 - 你必须添加依赖项,这个库提供了 multidex:compile 'com.android.support:multidex:1.0.1'

关于android : NoClassDefFoundError for android 4. 4及以下,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36889914/

相关文章:

java - Maven Spring Jar 项目 java.lang.ClassNotFoundExceptiona

android - Dumpsys meminfo中出现的 “Lost RAM”背后的概念是什么?

android - 如何在 android 4.4.2 中应用程序进入后台时禁用位置监听器

android - 状态栏颜色不会随着相对布局作为根元素而改变

android - C++ android assetmanager 从应用程序内部目录读取文件

android - 如何确定 AOSP 系统库二进制文件中使用了哪些源文件?

android - liblinphone android x86_64 ffmpeg 无法加载

.jar 中的 Java 调用函数

android - Robolectric 和 Android Studio 1.1.0 和库测试

android - 应用程序安装但在 KitKat 更新后未在 Google Glass 中显示