Ubuntu下Android(安卓)Studio Gradle sync failed peer not authenticated
16lz
2021-01-26
最近需要用到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/上即可完美解决。
更多相关文章
- android 指定打包资源文件的方法
- Android开发之EditText属性详解
- Android控件的一般属性
- Android(安卓)有输入框的页面,一打开就会弹出输入法,最简单屏蔽办
- Android(安卓)AutoCompleteTextView的使用
- 【转】更换android控件默认样式
- Android开机画面修改
- 改变ProgressBar默认颜色
- Mac 使用MuMu模拟器调试