android:适用于android 4.4及以下版本的NoClassDefFoundError [英] android : NoClassDefFoundError for android 4.4 and below

查看:310
本文介绍了android:适用于android 4.4及以下版本的NoClassDefFoundError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于sdk 19或更低版本,我的应用程序提供NoClassDefFoundError. 我陷入了困境

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
    }

现在我试图将其更改为

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

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

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.

我该如何调试此问题

推荐答案

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

I'm almost sure that it is multidex issue. If it's running properly on sdk 21 - it's multidex issue.

以下是官方信息: Multidex

如果您使用Application类的自定义实现,则必须扩展MultiDexApplication类.另外,还需要gradle标志.如果您不使用自定义Application类,则只需添加清单中提供的条目即可-文件中对此进行了描述.

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.

几乎忘了-您必须添加依赖项,该库提供了multidex:compile 'com.android.support:multidex:1.0.1'

Almost forgot - you've to add dependency, multidex is provided with this library: compile 'com.android.support:multidex:1.0.1'

这篇关于android:适用于android 4.4及以下版本的NoClassDefFoundError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆