28 有了它,我把所有的依赖项都更新到了版本 28.0.0 implementation 'com.android.support:appcompat-v7:28.0.0' . 上面说我有两个版本的图书馆, 和 26.1.0 . 我已经一个接一个地注释掉了我的自定义库,构建之后它仍然说我有两个版本。
28
28.0.0
implementation 'com.android.support:appcompat-v7:28.0.0'
26.1.0
如何解决这个问题?
apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' android { compileSdkVersion 28 defaultConfig { applicationId "com.appID" minSdkVersion 22 targetSdkVersion 28 versionCode 2 versionName "0.8.2" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false debuggable false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } repositories { mavenCentral() google() } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation 'com.android.support:appcompat-v7:28.0.0' implementation 'com.android.support:design:28.0.0' implementation 'com.android.support.constraint:constraint-layout:1.1.3' implementation 'com.android.support:recyclerview-v7:28.0.0' implementation 'com.android.support:cardview-v7:28.0.0' testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.2' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" //glide implementation 'com.github.bumptech.glide:glide:4.7.1' annotationProcessor 'com.github.bumptech.glide:compiler:4.7.1' //keyboardVisibilityPlugin implementation 'net.yslibrary.keyboardvisibilityevent:keyboardvisibilityevent:2.1.0' //swipeRevealLayout implementation 'com.chauthai.swipereveallayout:swipe-reveal-layout:1.4.1' //GoogleMaps implementation 'com.google.android.gms:play-services-maps:16.0.0' }
使用命令 gradlew app:dependencies (在文件夹中,其中 gradlew 在项目中),它将打印依赖关系树。
gradlew app:dependencies
gradlew
当您发现某些冲突依赖项时,请排除
compile ("com.someLibrary:1.0") { exclude group: 'com.android.support', module: 'appcompat-v7' }
您可以不检查冲突库而从所有中排除。。
configurations { all*.exclude group: 'com.android.support', module: 'appcompat-v7' }