Aja*_*rni 5 java android maven
我安装了最新版本的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
Run Code Online (Sandbox Code Playgroud)
因此,我删除了JDK 8并安装了JDK 9,添加了环境变量(在Windows 10中)。然后我重新启动系统并启动了android studio,但仍然遇到上述错误。我什至加了
repositories {
maven { url "https://maven.google.com" }
}
Run Code Online (Sandbox Code Playgroud)
gradle脚本。但是我仍然遇到同样的错误。如何解决此错误?
以下步骤可能会有所帮助:
1.将证书添加到密钥库-
从Android Studio的证书向Android Studio JDK证书导入一些证书。
Android Studio的证书可能位于
{your-home-directory}/.AndroidStudio3.0/system/tasks/cacerts
Run Code Online (Sandbox Code Playgroud)
我使用了以下导入命令。
$ keytool -importkeystore -v -srckeystore {src cacerts} -destkeystore {dest cacerts}
Run Code Online (Sandbox Code Playgroud)
2.将修改后的cacert路径添加到gradle.properties-
systemProp.javax.net.ssl.trustStore={your-android-studio-directory}\\jre\\jre\\lib\\security\\cacerts
systemProp.javax.net.ssl.trustStorePassword=changeit
Run Code Online (Sandbox Code Playgroud)
参考:https : //www.cresco.co.jp/blog/entry/2014/ /
小智 -1
尝试替换为
repositories {
maven { url 'http://repo1.maven.org/maven2' }
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
16118 次 |
| 最近记录: |