Android Studio androidx 包冲突解决方法


如果包冲突了会包如下这样的错:

Android dependency 'androidx.core:core' has different version for the compile (1.0.0) and runtime (1.0.1) classpath. You should manually set the same version via DependencyResolution


1.打开Terminal 输入: .
/gradlew -q app:dependencies
查看依赖冲突文件
2.在build.gradle里buildscript标签下添加

subprojects {
        project.configurations.all {
            resolutionStrategy.eachDependency { details ->
                if (details.requested.group == 'com.android.support'
                        && !details.requested.name.contains('multidex') ) {
                    details.useVersion "27.1.1"
                }

                if (details.requested.group == 'androidx.core'
                        && !details.requested.name.contains('androidx') ) {
                    
                }
            }
        }
    }

某个包冲突 就 在group androidx.core 并且指定Androidx 要用的版本

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM