【发布时间】:2017-11-16 07:28:26
【问题描述】:
我安装了最新版本的 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" }
}
渐变脚本。但我仍然遇到同样的错误。如何修复此错误?
【问题讨论】:
-
您有有效的互联网连接吗?在你的 android studio 首选项 -> Build, Execution -> Gradle 中,“离线工作”是否关闭?
-
是的,
Offline Work已关闭... -
您在防火墙后面吗?你能在浏览器上下载这个文件
https://dl.google.com/dl/android/maven2/com/android/support/appcompat-v7/26.1.0/appcompat-v7-26.1.0.pom吗? -
不,它会在浏览器中返回
404错误。 -
我有这个错误。修理它?帮帮我