how to solve the problem of "Inconsistencies in the existing project dependencies found"?

Viewed 879

I am learning to write android apps by watching some tutorials on youtube. I follow the tutorials and try to add the recyclerview in the xml file. When I click the download button next to the recyclerview, the following message is shown:

"This operation requires the library androidx.recyclerview:recyclerview:+.

Problem: Inconsistencies in the existing project dependencies found. Version incompatibility between: - androidx.appcompat:appcompat:1.1.0@aar and: - androidx.core:core-ktx:1.1.0@aar

With the dependency: - androidx.annotation::1.1.0 versus: - androidx.annotation::2.0.0

The project may not compile after adding this library. Would you like to add it anyway?"

If I choose OK and go ahead, the preview screen becomes grey.

What should I do to solve the problem?

The same problem occurs when I want to add the cardview in the xml file.

thanks in advance!!!!

The build.gradle is below:

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.2"
    defaultConfig {
        applicationId "com.smartherd.msgshareapp"
        minSdkVersion 21
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.core:core-ktx:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
1 Answers

Just build the project again and manually refresh the layout. :)

Related