Android studio gradle失败并出现错误:无法获取资源'https://jcenter.bintray.com/…/"

问题描述

我在Android Studio中同步项目时遇到问题。直到上周才出现问题。最初,我认为这可能是网络问题。但是我在移动热点,办公室VPN等中尝试过。错误显示

 > Could not resolve org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.72.
         > Could not get resource 'https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.3.72/kotlin-stdlib-jdk8-1.3.72.pom'.
            > Could not GET 'https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.3.72/kotlin-stdlib-jdk8-1.3.72.pom'.
               > sun.security.validator.ValidatorException: PKIX path building Failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
   > Could not resolve org.ow2.asm:asm:7.0.
     required by:
         project : > com.android.tools.build:gradle:4.0.1
         project : > com.android.tools.build:gradle:4.0.1 > com.android.tools.build:builder:4.0.1
      > Could not resolve org.ow2.asm:asm:7.0.
         > Could not get resource 'https://jcenter.bintray.com/org/ow2/asm/asm/7.0/asm-7.0.pom'.
            > Could not GET 'https://jcenter.bintray.com/org/ow2/asm/asm/7.0/asm-7.0.pom'.
               > sun.security.validator.ValidatorException: PKIX path building Failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
   > Could not resolve org.ow2.asm:asm-analysis:7.0.
     required by:
         project : > com.android.tools.build:gradle:4.0.1
      > Could not resolve org.ow2.asm:asm-analysis:7.0.
         > Could not get resource 'https://jcenter.bintray.com/org/ow2/asm/asm-analysis/7.0/asm-analysis-7.0.pom'.
            > Could not GET 'https://jcenter.bintray.com/org/ow2/asm/asm-analysis/7.0/asm-analysis-7.0.pom'.
               > sun.security.validator.ValidatorException: PKIX path building Failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
   > Could not resolve org.ow2.asm:asm-commons:7.0.
     required by:
         project : > com.android.tools.build:gradle:4.0.1
         project : > com.android.tools.build:gradle:4.0.1 > com.android.tools.build:builder:4.0.1
      > Could not resolve org.ow2.asm:asm-commons:7.0.
         > Could not get resource 'https://jcenter.bintray.com/org/ow2/asm/asm-commons/7.0/asm-commons-7.0.pom'.
            > Could not GET 'https://jcenter.bintray.com/org/ow2/asm/asm-commons/7.0/asm-commons-7.0.pom'.
               > sun.security.validator.ValidatorException: PKIX path building Failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
   > Could not resolve org.ow2.asm:asm-util:7.0.
     required by:
         project : > com.android.tools.build:gradle:4.0.1
         project : > com.android.tools.build:gradle:4.0.1 > com.android.tools.build:builder:4.0.1
      > Could not resolve org.ow2.asm:asm-util:7.0.
         > Could not get resource 'https://jcenter.bintray.com/org/ow2/asm/asm-util/7.0/asm-util-7.0.pom'.
            > Could not GET 'https://jcenter.bintray.com/org/ow2/asm/asm-util/7.0/asm-util-7.0.pom'.
               > sun.security.validator.ValidatorException: PKIX path building Failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
   > Could not resolve com.google.protobuf:protobuf-java:3.10.0.
     required by:
         project : > com.android.tools.build:gradle:4.0.1
         project : > com.android.tools.build:gradle:4.0.1 > com.android.tools.build:builder:4.0.1 > com.android.tools:sdk-common:27.0.1
         project : > com.android.tools.build:gradle:4.0.1 > com.android.tools.build:builder:4.0.1 > com.android.tools.analytics-library:protos:27.0.1
         project : > com.android.tools.build:gradle:4.0.1 > com.android.tools.build:builder:4.0.1 > com.android.tools.analytics-library:tracker:27.0.1
         project : > com.android.tools.build:gradle:4.0.1 > com.android.tools.build:aaptcompiler:4.0.1 > com.android.tools.build:aapt2-proto:4.0.1-6197926
      > Could not resolve com.google.protobuf:protobuf-java:3.10.0.
         > Could not get resource 'https://jcenter.bintray.com/com/google/protobuf/protobuf-java/3.10.0/protobuf-java-3.10.0.pom'.
            > Could not GET 'https://jcenter.bintray.com/com/google/protobuf/protobuf-java/3.10.0/protobuf-java-3.10.0.pom'.
               > sun.security.validator.ValidatorException: PKIX path building Failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
   > Could not resolve com.google.protobuf:protobuf-java-util:3.10.0.
     required by:
         project : > com.android.tools.build:gradle:4.0.1
      > Could not resolve com.google.protobuf:protobuf-java-util:3.10.0.
         > Could not get resource 'https://jcenter.bintray.com/com/google/protobuf/protobuf-java-util/3.10.0/protobuf-java-util-3.10.0.pom'.

我试图解决的问题:

  1. 尝试过的网络(从WiFi到移动热点)。
  2. 添加了此内容:maven {url“ http://jcenter.bintray.com”}

我了解到该问题归因于jcenter。但是我需要做些什么以及为什么,我不理解。我在某些地方看到他们要求这样做:您需要将jcenter的证书导入到Java密钥库中。但是我不确定如何获得该证书。

最奇怪的是为什么我突然得到这个问题。

我正在使用Android Studio 4.0.1。

谢谢, 阿林丹。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)