之前用Android studio一切正常,不过昨天下午突然报出这样的错误:Could not GET ‘https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.1.4/gradle-3.1.4.pom’.
试了很多办法,折腾了大半天终于让我给弄好了,具体办法如下:
1.File->Settings->Build,Execution,Deployment->Gradle->Android Studio,把这个对勾打上
现在重新试一下,如果好了就忽略下面的步骤
2.要是还不行那就在build.gradle中添加
maven { url ‘http://maven.aliyun.com/nexus/content/groups/public/’ }
添加之后如下所示:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
现在再试一次,反正我是成功了,希望能帮到你。