9

I installed Android Studio 4.1. I get the "build fail" error.

PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

I have tried to change the Gradle version and Gradle Plugin version, also the Java (8 and 11)but it doesn't work.

Due to limit 30000 charaters, so I posted it fully in the google doc. Full error in google doc

The detailed error is:

A problem occurred configuring root project 'First'.
> Could not resolve all artifacts for configuration ':classpath'.
   > Could not resolve com.google.flatbuffers:flatbuffers-java:1.12.0.
     Required by:
         project : > com.android.tools.build:gradle:4.2.0-alpha14
      > Could not resolve com.google.flatbuffers:flatbuffers-java:1.12.0.
         > Could not get resource 'https://jcenter.bintray.com/com/google/flatbuffers/flatbuffers-java/1.12.0/flatbuffers-java-1.12.0.pom'.
            > Could not GET 'https://jcenter.bintray.com/com/google/flatbuffers/flatbuffers-java/1.12.0/flatbuffers-java-1.12.0.pom'.
               > PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
   > Could not resolve org.tensorflow:tensorflow-lite-metadata:0.1.0-rc2.
     Required by:
         project : > com.android.tools.build:gradle:4.2.0-alpha14
      > Could not resolve org.tensorflow:tensorflow-lite-metadata:0.1.0-rc2.
         > Could not get resource 'https://jcenter.bintray.com/org/tensorflow/tensorflow-lite-metadata/0.1.0-rc2/tensorflow-lite-metadata-0.1.0-rc2.pom'.
            > Could not GET 'https://jcenter.bintray.com/org/tensorflow/tensorflow-lite-metadata/0.1.0-rc2/tensorflow-lite-metadata-0.1.0-rc2.pom'.
               > PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
   > Could not resolve org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.4.10.
     Required by:
         project : > com.android.tools.build:gradle:4.2.0-alpha14
         project : > com.android.tools.build:gradle:4.2.0-alpha14 > com.android.tools.build:builder:4.2.0-alpha14
         project : > com.android.tools.build:gradle:4.2.0-alpha14 > com.android.tools.build:aaptcompiler:4.2.0-alpha14
         project : > com.android.tools.build:gradle:4.2.0-alpha14 > com.android.tools.lint:lint-gradle-api:27.2.0-alpha14
         project : > com.android.tools.build:gradle:4.2.0-alpha14 > com.android.tools.build:gradle-api:4.2.0-alpha14
         project : > com.android.tools.build:gradle:4.2.0-alpha14 > androidx.databinding:databinding-compiler-common:4.2.0-alpha14
         project : > com.android.tools.build:gradle:4.2.0-alpha14 > com.android.tools.build:builder:4.2.0-alpha14 > com.android.tools.build:builder-model:4.2.0-alpha14
         project : > com.android.tools.build:gradle:4.2.0-alpha14 > com.android.tools.build:builder:4.2.0-alpha14 > com.android.tools:sdk-common:27.2.0-alpha14
         project : > com.android.tools.build:gradle:4.2.0-alpha14 > com.android.tools.build:builder:4.2.0-alpha14 > com.android.tools:common:27.2.0-alpha14
         project : > com.android.tools.build:gradle:4.2.0-alpha14 > com.android.tools.build:builder:4.2.0-alpha14 > com.android.tools.build:manifest-merger:27.2.0-alpha14
         project : > com.android.tools.build:gradle:4.2.0-alpha14 > com.android.tools.build:builder:4.2.0-alpha14 > com.android.tools.analytics-library:tracker:27.2.0-alpha14
         project : > com.android.tools.build:gradle:4.2.0-alpha14 > com.android.tools.lint:lint-gradle-api:27.2.0-alpha14 > com.android.tools.lint:lint-model:27.2.0-alpha14
         project : > com.android.tools.build:gradle:4.2.0-alpha14 > com.android.tools.build:builder:4.2.0-alpha14 > com.android.tools:sdklib:27.2.0-alpha14 > com.android.tools:repository:27.2.0-alpha14
         project : > com.android.tools.build:gradle:4.2.0-alpha14 > com.android.tools.build:builder:4.2.0-alpha14 > com.android.tools:sdk-common:27.2.0-alpha14 > com.android.tools.analytics-library:shared:27.2.0-alpha14
      > Could not resolve org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.4.10.
         > Could not get resource 'https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.4.10/kotlin-stdlib-jdk8-1.4.10.pom'.
            > Could not GET 'https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.4.10/kotlin-stdlib-jdk8-1.4.10.pom'.
               > PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

3 Answers3

18

In my case, I got this error when I upgraded Android Studio to 4.2 and commented jcenter maven repository in build.gradle, Got it resolved after uncommenting repository.

Example:

repositories {
    google()
    mavenCentral()
    //jcenter()
    /*maven {
        url "https://maven.google.com"
    }*/
}
Bruce
  • 793
  • 8
  • 17
8

In my case, I added mavenCentral() and commented "maven { ..." like below in build.gradle.

buildscript {
repositories {
    google()
    mavenCentral()
    /*maven {
        url "https://maven.google.com"
    }*/
    //jcenter()
}

...

Pisumathu
  • 411
  • 1
  • 5
  • 10
0

Its problem come windowns 10 if u have same issues then only solutions is change network configration in control panal in windowns 10 firewal not give access you this download gradle file or let conneted with wifi . as well as win+r >> servics>dns restart and restart pc

Ashif
  • 441
  • 5
  • 12