我安装了最新版本的android studio。我有已经安装的 jdk 8。当我打开 android studio 时,出现以下错误。
Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve com.android.support:appcompat-v7:26.1.0.
Could not resolve com.android.support:appcompat-v7:26.1.0.
Required by:
project :app
> Could not resolve com.android.support:appcompat-v7:26.1.0.
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/support/appcompat-v7/26.1.0/appcompat-v7-26.1.0.pom'.
> Could not GET 'https://dl.google.com/dl/android/maven2/com/android/support/appcompat-v7/26.1.0/appcompat-v7-26.1.0.pom'.
> sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
> PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
> unable to find valid certification path to requested target
所以我删除了 JDK 8 并安装了 JDK 9,添加了环境变量(在 Windows 10 中)。然后我重新启动我的系统并启动android studio,我仍然遇到上述错误。我什至补充说
repositories {
maven { url "https://maven.google.com" }
}
分级脚本。但我仍然遇到同样的错误。我该如何解决这个错误?
原文由 Ajay Kulkarni 发布,翻译遵循 CC BY-SA 4.0 许可协议
以下步骤可能会有所帮助:
1.将证书添加到密钥库-
从 Android Studio 的 cacerts 导入一些认证到 Android Studio JDK cacerts。
Android Studio 的 cacerts 可能位于
我使用了以下导入命令。
2.在gradle.properties中添加修改cacert路径-
参考: https ://www.cresco.co.jp/blog/entry/2014/ /