首页 > 解决方案 > PKIX 路径构建失败:sun.security.provider.certpath.SunCertPathBuilderException:代理后面

问题描述

Android Studio 突然开始出现此错误:

A problem occurred configuring root project 'Projectname'.
> Could not resolve all artifacts for configuration ':classpath'.
   > Could not download gradle.jar (com.android.tools.build:gradle:3.4.2)
      > Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.4.2/gradle-3.4.2.jar'.
         > Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.4.2/gradle-3.4.2.jar'.
            > Connection reset

   > Could not download builder.jar (com.android.tools.build:builder:3.4.2)
      > Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/builder/3.4.2/builder-3.4.2.jar'.
         > Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/builder/3.4.2/builder-3.4.2.jar'.
            > PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
   > Could not download tracker.jar (com.android.tools.analytics-library:tracker:26.4.2)

我已经导出了证书(名称:dlgooglecom)并将其添加到 cacert 但仍然是同样的错误。

 keytool.exe -import -trustcacerts -alias androidstudiocerts -file dlgooglecom.cer -keystore "C:\Program Files\Android\Android Studio1\jre\lib\security\cacerts"

输出 :

C:\Program Files\Android\Android Studio1\jre\bin> keytool.exe -import -trustcacerts -alias dlgoogle1 -file dlgooglecom.cer -keystore "C:\Program Files\Android\Android Studio1\jre\lib\security\cacerts"
Warning: use -cacerts option to access cacerts keystore
Enter keystore password:
Certificate already exists in keystore under alias <dlgoogle>
Do you still want to add it? [no]:  yes
Certificate was added to keystore

请有人指导。我在代理后面,代理连接工作正常。

标签: javaandroidandroid-studiopkixcacerts

解决方案


推荐阅读