011 Error:Failed to resolve: com.android.support:recyclerview-v7:28.0.0解决方法

011 Error:Failed to resolve: com.android.support:recyclerview-v7:28.0.0解决方法

参考链接:
https://blog.csdn.net/qq874455953/article/details/83025425

在使用Android Studio的过程中需要添加依赖recyclerview,出现报错:

Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.android.support:recyclerview-v7:27.1.1. 报错原因:添加依赖的方法错误。添加了不存在的依赖。解决办法:查看sdk文件夹中真实存在的依赖版本。

mark

本人电脑中的路径:E:AndroidSdkextrasandroidm2repositorycomandroidsupport ecyclerview-v7
mark

修改build.gradle文件,添加真实存在的依赖版本,注意sdk版本与依赖版本一致。
mark

重新build 构建gradle 即可。

本人最终配置,gradle构建成功的版本:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 30

    defaultConfig {
        applicationId "com.example.recyclerviewtest"
        minSdkVersion 14
        targetSdkVersion 30
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:+'
    implementation 'com.android.support:recyclerview-v7:24.2.1'
    implementation 'com.android.support.constraint:constraint-layout:2.0.4'
    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'
}

原文地址:https://www.cnblogs.com/xlfcjx/p/14383087.html