最有效的解决方案:Unable to resolve dependency for ':[email protected]/compileClasspath': Could not download xx.jar
程序员文章站
2022-06-05 14:20:23
...
网上百度和google了很久,无非就是关闭androidStudio的settings里的gradle的offline。但是在我这并不好使。
根本原因是jcenter 不稳定造成的下载中断
解决方案
1.修改项目下的build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
// 1 jcenter()
maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/'}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
// 2 jcenter()
maven{url 'http://maven.aliyun.com/nexus/content/groups/public/'}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}