错误:无法解析':app @ debug / compileClasspath'的依赖关系:无法解析androidx.recyclerview:recyclerview:1.1.0

时间:2020-03-31 06:40:58

标签: android android-recyclerview

该如何解决?在我的build.gradle模块级别文件中,当我添加recyclerview的依赖项时,在同步project.gradle版本和android版本后,都收到了此错误。

APP级build.gradle:

apply plugin: 'com.android.application'

    android {
        compileSdkVersion 29
        buildToolsVersion "29.0.0"

        defaultConfig {
            applicationId "com.example.recyclerexample"
            minSdkVersion 16
            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 'androidx.appcompat:appcompat:1.1.0'

        implementation "androidx.recyclerview:recyclerview:1.1.0"
        // For control over item selection of both touch and mouse driven selection
        implementation "androidx.recyclerview:recyclerview-selection:1.1.0-rc01"

        implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
        testImplementation 'junit:junit:4.12'
        androidTestImplementation 'androidx.test.ext:junit:1.1.1'
        androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'


    }

project level build.gradle file

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

    repositories {
        google()
        jcenter()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.6.1'


        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()

    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

我收到此错误“错误:无法解析':app @ debug / compileClasspath'的依赖项:无法解析androidx.recyclerview:recyclerview:1.1.0”

1 个答案:

答案 0 :(得分:0)

共享您的项目级gradle文件