安装Android studio 3.5.3遇到了gradle的同步问题unable to find valid certification path to requested target。解决方法如下:
1. 进入项目级的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.5.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/jcenter' }
mavenLocal()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
这一步是为了利用阿里的镜像进行加速,提高gradle同步的下载速度。
2. 用谷歌浏览器进入阿里云仓库服务,按下面图片的步骤保存网站的证书。
点击网址坐标的标识,点击证书。
点击复制到文件把证书保存到本地
3. 在android studio中通过setting找到下图的设置选项
点击图中加号把刚刚的证书添加进来
点击使缓存失效并重启
重启后重新同步