網上百度和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
}