一、报错信息
sun.security.validator.ValidatorException: PKIX path building failed:
sun.security.provider.certpath.SunCertPathBuilderException:
unable to find valid certification path to requested target
这个错误是由于Glide库在加载图片时遇到了证书验证的问题。具体来说,它表示Glide无法建立一个有效的证书路径来验证目标服务器的证书。 所以我们将原先的google()和jcenter()仓库替换为国内的仓库。
二、解决方法
1、在build.gradle(Project)
的buildscript
闭包下替换为阿里云maven仓库:
maven {url 'https://maven.aliyun.com/repository/public/'}
maven {url 'https://maven.aliyun.com/repository/google/'}
maven {url 'https://maven.aliyun.com/repository/central/'}
maven {url 'https://maven.aliyun.com/repository/gradle-plugin/'}
2、在build.gradle(Project)
的allprojects
闭包下也替换为阿里云maven仓库:
3.点击同步,开始下载依赖
三、更多Android教程
✨还可以关注宫纵号《编程乐学》,菜单栏有很多优质的开源项目以及更多的编程资料等你来学习。