'实现'com.android.support:recyclerview-v7:28.0.0'给出无法获取资源错误

时间:2019-06-07 16:33:21

标签: android gradle android-recyclerview

我在Android项目中使用的是Android Studio 3.0和 我正在尝试添加

'implementation 'com.android.support:recyclerview-v7:28.0.0'

同步后,出现以下错误,但我没有发现问题所在。 无法解析配置的所有依赖项

':app:debugRuntimeClasspath'.
Could not determine artifacts for com.android.support:recyclerview-v7:28.0.0
Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/support/recyclerview-v7/28.0.0/recyclerview-v7-28.0.0.aar'.
Could not HEAD 'https://dl.google.com/dl/android/maven2/com/android/support/recyclerview-v7/28.0.0/recyclerview-v7-28.0.0.aar'.
Connect to dl.google.com:443 [dl.google.com/192.168.1.1] failed: Connection refused (Connection refused)
Connection refused (Connection refused)

其他信息:

compileSdkVersion 28
minSdkVersion 16
targetSdkVersion 28

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


buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.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
}

1 个答案:

答案 0 :(得分:0)

从build.gradle中删除这些行,然后尝试再次同步,可能是这些行引起了问题。

 androidTestImplementation 'com.android.support.test:runner:1.0.2'
 androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'