简体   繁体   中英

My Gradle is detecting multiple appCompat versions

I've updated compileSDK to 28 and with it I've updated all of my dependencies to version 28.0.0 . But I have problem with implementation 'com.android.support:appcompat-v7:28.0.0' . It says that I have two versions of this library, 28.0.0 and 26.1.0 . I've commented out my custom libraries one by one and after build it still says that I have two versions.

How to fix this problem?

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'

}

Option1

Find conflict dependency

Use command gradlew app:dependencies (in folder where gradlew in project), it will print you dependency tree.

Exclude

When you find some conflict dependency, then exclude

compile ("com.someLibrary:1.0") {
    exclude group: 'com.android.support', module: 'appcompat-v7'
}

Option2

You can just exclude from all without checking conflict library..

configurations {
    all*.exclude group: 'com.android.support', module: 'appcompat-v7'
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM