问题一
android studio默认从Google下载gradle,下载速度超慢,还有可能下载失败,我们把下载网址改成阿里的就可以解决了,下载速度很快。
问题二
如果你的程序一打开就出现了Cause: unable to find valid certification path to requested target的报错,下面的方法也可以帮你解决。
1.打开build.gradle文件
2.将网址粘贴进去
网址如下:
buildscript {
repositories {
maven { url 'https://maven.aliyun.com/repository/public' }
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/jcenter' }
maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
maven { url 'https://dl.bintray.com/guardian/android' }
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
maven { url 'http://maven.aliyun.com/nexus/content/repositories/google' }
maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' }
maven { url 'http://maven.aliyun.com/nexus/content/repositories/gradle-plugin' }
maven { url "https://jitpack.io" }
google()
// jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.1'
}
}
allprojects {
repositories {
maven { url 'https://maven.aliyun.com/repository/public' }
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/jcenter' }
maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
maven { url 'https://dl.bintray.com/guardian/android' }
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
maven { url 'http://maven.aliyun.com/nexus/content/repositories/google' }
maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' }
maven { url 'http://maven.aliyun.com/nexus/content/repositories/gradle-plugin' }
maven { url "https://jitpack.io" }
google()
// jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
3.重新加载一下
注:
如果仍然下载不了不用怕,咱还有必杀技,把上面红框里的内容换成下面的,亲测有效,但是有一个缺点可能一次成功不了,每次可能只下载一点就报错了,但是多试几次就可以了。
buildscript {
repositories {
//复制下面四行
mavenCentral()
jcenter()
mavenLocal()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
}
}
allprojects {
repositories {
//复制下面四行
mavenCentral()
jcenter()
mavenLocal()
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
如果仍然有Cause: unable to find valid certification path to requested target的报错信息,估计你要下载证书了,推荐看看这篇文章:关于AndroidStudio Cause: unable to find valid certification path to requested target 报错的解决方法