问题描述
我需要你的帮助。我必须在公司制作Android应用程序,并且在运行和配置Android Studio时遇到一些问题。网络使用代理(来自Zscaler),我无法从Gradle脚本同步项目。
I need your help. I have to make an Android app in a company and have some problems to run and configure Android Studio. The network uses a proxy (from Zscaler) and I can't synchronize project from Gradle scripts.
管理员已经向我提供了代理地址和检查连接设置,使用 build.gradle
脚本中的2个下载域成功连接。但它不适用于Gradle同步。
The administrator have given to me the proxy address and on check connection settings, connection is successful with the 2 download domains from the build.gradle
scripts. But it doesn't work on Gradle sync.
以下错误:
正常情况下 build.gradle
:
使用maven块上的http:无法获取(来自带有
http的jcenter二进制文件)
With http on maven blocks: Could not GET (From jcenter binary with http)
无法使用找到有效的证书路径。
Unable to find valid certification path.
我还从公司手动导入证书,但它不起作用。
您可以查看图片以显示我尝试过的配置,但它不起作用。
I have also import manually certificates from the company, but it doesn't work.You can look on images to show you my configuration I have tried, and it doesn't work.
图片链接:
- https://ibb.co/bJxT9d
- https://ibb.co/e7wMUd
- https://ibb.co/inro9d
- https://ibb.co/gic6vJ
- https://ibb.co/eS04hy
- https://ibb.co/bOfLNy
请帮帮我,这非常重要。否则我无法做到目标。
Help me please, it's extremely important. I can't do the objectives otherwise.
推荐答案
您需要将公司代理证书注入java尝试的cacerts密钥库中下载文件。这可能是随Android Studio提供的OpenJDK版本或操作系统使用的版本。
You need to inject your companies proxy cert into the cacerts keystore of the java attempting to download files. This may be either the OpenJDK version that is supplied with your Android Studio or the one being used by the operating system.
Keytool位于/ jre / bin
Keytool is located in /jre/bin
cacerts文件位于/ jre / lib / security
The "cacerts" file is located in /jre/lib/security
运行以下内容
keytool -importcert -file <path to cert> -keystore <path to cacerts>
-alias <anything>
系统会提示您输入密码,默认为changeit
You'll be prompted for the password, default is "changeit"
然后会询问您是否信任该证书,请键入yes。
You'll then be asked if you trust the cert, type yes.
这篇关于Android Studio Gradle Sync与公司代理失败:无法找到有效的证书路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!