报错:ERROR: Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve XX.XX

我用的as的版本是3.4.2,window10系统。

build.gradle文件配置:

// 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.4.2'

        // 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
}

gradle-wrapper.properties文件:

#Mon Oct 16 10:43:19 CST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip

出现错误:

ERROR: Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve io.reactivex.rxjava2:rxjava:2.1.13.
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve io.reactivex.rxjava2:rxandroid:2.0.2.
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.squareup.retrofit2:retrofit:2.5.0.
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.squareup.retrofit2:converter-gson:2.5.0.
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.squareup.retrofit2:adapter-rxjava2:2.4.0.
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.jcodecraeer:xrecyclerview:1.3.2.
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve io.reactivex.rxjava2:rxjava:2.1.13.
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve io.reactivex.rxjava2:rxandroid:2.0.2.
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve com.squareup.retrofit2:retrofit:2.5.0.
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve com.squareup.retrofit2:converter-gson:2.5.0.
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve com.squareup.retrofit2:adapter-rxjava2:2.4.0.
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve com.jcodecraeer:xrecyclerview:1.3.2.
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve io.reactivex.rxjava2:rxjava:2.1.13.
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve io.reactivex.rxjava2:rxandroid:2.0.2.
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve com.squareup.retrofit2:retrofit:2.5.0.
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve com.squareup.retrofit2:converter-gson:2.5.0.
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve com.squareup.retrofit2:adapter-rxjava2:2.4.0.
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve com.jcodecraeer:xrecyclerview:1.3.2.
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@release/compileClasspath': Could not resolve io.reactivex.rxjava2:rxjava:2.1.13.
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@release/compileClasspath': Could not resolve io.reactivex.rxjava2:rxandroid:2.0.2.
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@release/compileClasspath': Could not resolve com.squareup.retrofit2:retrofit:2.5.0.
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@release/compileClasspath': Could not resolve com.squareup.retrofit2:converter-gson:2.5.0.
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@release/compileClasspath': Could not resolve com.squareup.retrofit2:adapter-rxjava2:2.4.0.
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@release/compileClasspath': Could not resolve com.jcodecraeer:xrecyclerview:1.3.2.
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not resolve io.reactivex.rxjava2:rxjava:2.1.13.
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not resolve io.reactivex.rxjava2:rxandroid:2.0.2.
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not resolve com.squareup.retrofit2:retrofit:2.5.0.
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not resolve com.squareup.retrofit2:converter-gson:2.5.0.
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not resolve com.squareup.retrofit2:adapter-rxjava2:2.4.0.
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not resolve com.jcodecraeer:xrecyclerview:1.3.2.
Show Details
Affected Modules: app

在网上找了很多的解决方法,比如在AS中关掉代理:

报错:ERROR: Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve XX.XX_第1张图片

结果还是不行。

网上有人说,去掉 gradle.properties 的代理设置,而我的AS的 gradle.properties 没有代理的配置:

报错:ERROR: Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve XX.XX_第2张图片

后来找到办法了,需要修改 C:\Users\gs\.gradle\gradle.properties 文件,注释掉proxy的设置,如下:

报错:ERROR: Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve XX.XX_第3张图片

再次build,ok。

总结,是因为我本地的 小飞机 到期了,不能使用了,刚好就出现了这个情况,哎。。。。只想静静的coding,怎么就这么难呢!!!!

你可能感兴趣的:(Android)