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