如何修复错误:找不到recyclerview-v7.jar(com.android.support:recyclerview-v7:28.0.0)

时间:2019-04-03 08:13:27

标签: android android-gradle android-studio-3.0

我是Android新手。我想在项目中使用recyclerview,当我将com.android.support:recyclerview-v7:28.0.0实现为依赖项并构建项目时,出现此错误:

Could not find recyclerview-v7.jar (com.android.support:recyclerview-v7:28.0.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/support/recyclerview-v7/28.0.0/recyclerview-v7-28.0.0.jar


Please install the Android Support Repository from the Android SDK Manager.
Open Android SDK Manager

我的build.gradle(Module:app):

apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
    applicationId "com.example.myapplication"
    minSdkVersion 15
    targetSdkVersion 28
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
    }
}
}

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

和build.gradle(Myapplication):

buildscript {
repositories {
    google()
    jcenter()


}
dependencies {
    classpath 'com.android.tools.build:gradle:3.3.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
}

通过sdk管理,已安装android支持库,我的Android sdk工具为26.1.1

有人可以帮助我解决此错误吗?

1 个答案:

答案 0 :(得分:0)

您必须如图所示从SDK Tools安装支持存储库。勾选支持存储库中的复选框并安装enter image description here