Ubuntu下Android Studio Gradle sync failed peer not authenticated

最近需要用到Ubuntu,不料遇到了一个奇葩问题,尝试了各种方法没有结果,后来在github上找到了解决方法。原因是https导致的,把证书导入进可以了。参考https://github.com/meteor/meteor/issues/6362#issuecomment-189852511

Step 1:Download the certificate

  • Open Mozilla Firefox :
  • Go to https://repo1.maven.org.
  • Click on the green padlock at the left of adress bar.
  • Click on Details.
  • Click on View certificate.
  • Click on Details.
  • Click on Export.
  • Export file to “X.509 Certificate (PEM) (.crt; .pem)”

Step 2 : Add the certificate to default java keystore

sudo keytool -import -alias MavenRepo -keystore $JAVA_HOME/jre/lib/security/cacerts -file /PATH/TO/YOUR/EXPORTED/FILE.crt

Your $JAVA_HOME variable is normally declared in your .bashrc file, so you can use this command just replacing the /PATH/TO/YOUR/EXPORTED/FILE parameter.

Ubuntu下OpenJDK的默认目录在/usr/lib/jvm/

PS : The default password of java keystore is : changeit

默认的秘钥是changeit,提示输入的时候输入即可。

以上操作重复两遍分别应用于https://jcenter.bintray.com/https://services.gradle.org/上即可完美解决。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值