Android studio
引入第三方包运行项目时出现java.lang.ClassNotFoundException错误,包冲突多次引入
解决方案:
新建application 集成MultiDexApplication
`public class MultiDexApplication extends Application {
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
}`
build.gradle配置
defaultConfig {
multiDexEnabled true
}
lintOptions {
checkReleaseBuilds false
abortOnError false
}
dexOptions {
javaMaxHeapSize "4g"
}
packagingOptions {
exclude 'META-INF/rxjava.properties'
exclude 'META-INF/rxjava'
}
网友评论