我如何反转我的 android 工作室以逃避此 PKIX 路径构建失败:sun.security.provider.certpath.SunCertPathBuilderException:..?

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

我最近将我的 flutter 版本更新为 2.0.0,在将 pub 包版本更新到最新版本后,它在 iOS 上运行良好。不幸的是,它在 Android 上不起作用,我想更新 Android 工作室。从那以后我一直收到证书错误,我尝试了以下,在其他 Whosebug 答案中指定但没有结果:

  1. 将来自 maven、jcenter 和 google 的证书添加到 jdk
  2. 多次更改build.gradle版本
  3. 下载了新的 sdk 工具
  4. 接受了来自flutter doctor --android-licenses
  5. 的所有许可
  6. 尝试重新安装一个旧的 flutter 和运行一个来自它的应用程序
  7. 已下载新的 jdks

.. 无济于事 在这一点上,我只想要我的旧 android :(

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

万一你有同样的问题,并且你已经尝试了你在堆栈溢出中找到的所有东西..这为我解决了它:

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

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

注意:我还想补充一点,在我执行了第 2 步之后,撤消第 1 步对 flutter 相关项目有效