关于4.x dex引起的java.lang.NoClassDefFoundError等问题

来源:互联网 发布:mac java 安装问题 编辑:程序博客网 时间:2024/06/08 19:25

I faced the same issue and fixed it. It is issue with Dex Limit. Because the dex limit is reached, it creates two dex files. Lollipop knows how to read, preLollipop has no idea unless you tell it in application class.
就是dex限制问题,android5.x及以上的都知道,之前的版本要加一句话在 dependencies{}中

android {
compileSdkVersion 21
buildToolsVersion "21.1.0"

defaultConfig {    ...    minSdkVersion 14    targetSdkVersion 21    ...    // Enabling multidex support.    multiDexEnabled true}...

}

dependencies {
compile 'com.android.support:multidex:1.0.0'
}

还要在Manifest.xml的application 标签中加入以下一句话:
<?xml version="1.0" encoding="utf-8"?>
package="com.example.android.multidex.myapplication">
...
android:name="android.support.multidex.MultiDexApplication">
...

阅读全文
0 0
原创粉丝点击