您的位置:首页 > 移动开发 > Android开发

Ubuntu下Android Studio Gradle sync failed peer not authenticated

2016-05-28 19:18 579 查看
最近需要用到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/上即可完美解决。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息