天天看点

Android Studio - Unable to find valid certification path to requested target

报错日志

代码没改、一直好好的工程Android Studio突然报错了

Unable to find valid certification path to requested target
           

成功翻墙google都可以上了也不行,设置代理也不行。于是网上找答案看到这个https://www.jianshu.com/p/48b1b577ed13。大概是说关闭了Charles 代理就可以了,问题是我没有开Charles 啊。

分析解决

这个报错确实是网络问题。如果你用了代理,直接关掉就好了,Android Studio不翻墙是可以链接到开发者中心的。

Could not download groovy-all.jar

FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve all files for configuration ':linux_demo_project:lintClassPath'.
> Could not download groovy-all.jar (org.codehaus.groovy:groovy-all:2.4.12)
   > Could not get resource 'https://jcenter.bintray.com/org/codehaus/groovy/groovy-all/2.4.12/groovy-all-2.4.12.jar'.
           

这个错误比较麻烦,总而言之是网络代理的问题。当前正是国庆节之前,各大vpn不能用了、本来20多种vpn现在能够用的只有两三个了。再来说说怎么解决这个问题。首先是要设置代理。其次,我发现下载不同的依赖的时候,需要不断的切换代理。就是说我在两个vpn之间切换网络最后才把所有依赖下载完毕。另外这个问题还可以尝试的方向有哪些?降低android studio的版本、gradle版本要修改为和studio保持匹配、使用阿里巴巴仓库、切换网络模式等等。