AndroidStudio构建项目提示错误信息“unable to find valid certification”的完美解决方案
手抖了一下,把AS升级到了最新版本,然后就悲剧了,公司的项目跑不起来,提示“unable to find valid certification”,新建项目也是一样的提示。之前总结的解决方案都用了,没一个好使的,经过两个下午的折腾,终于还是被我整好了,感动的泪水都要流出来了 (╥╯^╰╥)
直接放我的最新解决方案,look~
第一步:如下所示,在项目的build.gradle的两个repositories中添加阿里public镜像,最好放在google() 前面:
buildscript { repositories { maven { url 'https://maven.aliyun.com/repository/public' } google() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.6.3' } } allprojects { repositories { maven { url 'https://maven.aliyun.com/repository/public' } google() jcenter() } }
第二步:一般情况下做完第一步就OK了,不过有些小伙伴的AS还是会报错,并有如下提示,意思是说你使用不同的jdk会导致 gradle生成多个守护进程,虽然是个提示,但当你点了“Select a JDK from the File System”配置完jdk之后,会发现AS居然不报错了,所以有时候提示信息也不容小觑。
第三步:什么?还报错?那干脆把google()和jcenter()也换成阿里的仓库镜像吧~
maven { url 'https://maven.aliyun.com/repository/google' } maven { url 'https://maven.aliyun.com/repository/jcenter' }
第四步:如果还是提示“unable to find valid certification”之类的错误信息,那就需要在AS中添加证书了,我这里提供阿里和jcenter证书供大家下载。
PS:可能大家会有疑问,如果每一次创建项目都要在build.gradle中配置一次阿里镜像,岂不是很麻烦,有没有一劳永逸的方法,of course,look >~<
在你的AS安装目录里找到 plugins\android\lib\templates\gradle-projects\NewAndroidProject\root下找到 build.gradle.ftl,
在build.gradle.ftl 添加阿里镜像,保存之后重启AS,新建项目就会发现project下的build.gradle中已经添加了阿里镜像。
总结
到此这篇关于AndroidStudio构建项目提示错误信息“unable to find valid certification”的完美解决方案的文章就介绍到这了,更多相关AndroidStudio项目提示unable to find valid certification内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家!
您可能感兴趣的文章:
- 解决错误:unable to find valid certification path to requested target
- Android Studio gradle 提示"unable to find valid certification"的解决办法
- python安装Crypto提示错误:Unable to find vcvarsall.bat 的解决方案
- 请求https错误: unable to find valid certification path to requested target
- 解决方案:PKIX path building failed:unable to find valid certification path to requested target
- 错误提示:Unable to find an installation of R on the system which R didn't return valid output
- 请求https错误: unable to find valid certification
- Android studio3.6 Build failed下提示unable to find valid certification path to requested target
- 请求https错误: unable to find valid certification path to requested target
- 关于AndroidStudio Cause: unable to find valid certification path to requested target 报错的解决方法
- SunCertPathBuilderException: Unable To Find Valid Certification Path To Requested Target
- 完美解决“Unable to find vcvarsall.bat”错误,有需要的朋友可以参考下。【转自互联网】
- 彻底解决unable to find valid certification path to requested target
- 【综合】Android Studio出现:Cause: unable to find valid certification path to requested target
- 错误 Unable to find vcvarsall.bat 的终极无敌最完美的解决办法
- 解决PKIX path building failed的问题unable to find valid certification path to requested target
- Java调用https服务报错unable to find valid certification path to requested target的解决方法
- 解决unable to find valid certification path to requested target的方法
- No more 'unable to find valid certification path to requested target'
- android Eclipse执行项目提示错误: unable to execute dex: GC orerhead limit exceeded