Multiple dex files define解决记录
引用多个library时经常会遇到Multiple dex files define错误
Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Landroid/arch
/core/util/Function;
此时可用以下gradle命令来查看工程的引用树,找出冲突的引用库后exclude之
cd app
..\gradlew -q dependencies
最常见的是support库多次定义,经检查本文是由于引入RxLifecycle
导致android.arch.lifecycle.runtime
库重复引用问题
compile 'io.reactivex.rxjava2:rxjava:2.2.0'
compile('com.github.tbruyelle:rxpermissions:0.10.2', {
exclude group: 'io.reactivex.rxjava2', module: 'rxjava'
})
compile('com.trello.rxlifecycle2:rxlifecycle:2.2.2', {
exclude group: 'io.reactivex.rxjava2', module: 'rxjava'
exclude group: 'android.arch.lifecycle', module: 'runtime'
})
compile('com.trello.rxlifecycle2:rxlifecycle-android-lifecycle:2.2.2', {
exclude group: 'io.reactivex.rxjava2', module: 'rxjava'
exclude group: 'android.arch.lifecycle', module: 'runtime'
})
compile('com.trello.rxlifecycle2:rxlifecycle-android:2.2.2', {
exclude group: 'io.reactivex.rxjava2', module: 'rxjava'
exclude group: 'android.arch.lifecycle', module: 'runtime'
})
compile('com.trello.rxlifecycle2:rxlifecycle-components:2.2.2', {
exclude group: 'io.reactivex.rxjava2', module: 'rxjava'
exclude group: 'android.arch.lifecycle', module: 'runtime'
})
版权声明:
作者:Joe.Ye
链接:https://www.appblog.cn/index.php/2023/03/11/multiple-dex-files-define-resolution-records/
来源:APP全栈技术分享
文章版权归作者所有,未经允许请勿转载。
THE END
0
二维码
打赏
海报
Multiple dex files define解决记录
引用多个library时经常会遇到Multiple dex files define错误
Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.b……
文章目录
关闭
共有 0 条评论