Skip to content
Advertisement

How can i reverse my android studio to escape this PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException:..?

I recently updated my flutter version to 2.0.0 and it worked fine on iOS after updating the pub packages versions to the latest. It unfortunately didn’t work on Android and i thought of updating the Android studio. Since then I have been getting certificate errors and I have tried the following, specified in other stackoverflow answers with no result:

  1. adding certificates from maven,jcenter and google to jdk
  2. changed build.gradle version several times
  3. downloaded new sdk tools
  4. accepted all licenses from flutter doctor --android-licenses
  5. tried reinstalling an old flutter and running an app from it
  6. downloaded new jdks

.. all to no avail At this point, I just want my old android back 🙁

build.gradle

/*
 * Copyright 2019 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

buildscript {
    repositories {
        jcenter()

        google()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:4.1.2'
    }
}

allprojects {
    repositories {
        jcenter()
        google()

    }
}

gradle-wrapper.properties

#Sat Mar 06 06:08:23 MSK 2021
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https://services.gradle.org/distributions/gradle-6.5-bin.zip

Error message

A problem occurred configuring root project 'ActivitySceneTransitionBasic'.
> Could not resolve all artifacts for configuration ':classpath'.
   > Could not resolve com.android.tools.build:gradle:4.1.2.
     Required by:
         project :
      > Could not resolve com.android.tools.build:gradle:4.1.2.
         > Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/4.1.2/gradle-4.1.2.pom'.
            > Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/4.1.2/gradle-4.1.2.pom'.
               > sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

Advertisement

Answer

In case you have this same issue and you have tried everything you found on stack overflow.. this solved it for me: https://stackoverflow.com/a/66549260/11320345

Add systemProp.https.proxyHost= to your gradle-wrapper.properties file

  1. https://stackoverflow.com/a/66572690/11320345

Unselect proxies in your system preferences -> Network -> Advanced -> (Your current network)

NOTE: I would also like to add that after i followed the step number 2, undoing step 1 worked for flutter related projects

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement