gpt4 book ai didi

java - “PKIX 路径构建失败 - 无法找到到请求目标的有效证书路径”(在具有身份验证的公司代理后面)

转载 作者:行者123 更新时间:2023-11-30 12:05:30 31 4
gpt4 key购买 nike

我正在尝试 flutter 和 react-native(我是初学者开发人员),我必须为我的公司构建一个小型原型(prototype),但我无法通过“运行我的第一个应用程序”这一步由于证书错误(详见下文)。

我在一个需要身份验证的公司 ssl 代理后面,我们也有一个内部证书链。现在,我对证书的整体经验为零,所以请注意初学者如何尝试解决这个问题。

我已经在网上梳理了解决方案,但我对我发现的一些内容一头雾水:

  1. 有些人推荐使用 InstallCert java 应用程序,但由于代理原因我无法使用,而且找不到允许我为代理设置用户名和密码的版本。

  2. 使用 key 工具将证书存储到 java cacerts 文件中,但我不知道应该安装哪个证书:存储库的(dl.google.com?),还是我公司的。

  3. 是否可以下载该 .pom 文件并将其存储在某处,这样它就无需访问互联网即可运行?我可以很好地访问 dl.google.com 域并下载它。

下面我粘贴了我的 build.gradle 文件和确切的错误。

buildscript {
repositories {
google()
jcenter()
}

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

allprojects {
repositories {
google()
jcenter()
}
}

rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
delete rootProject.buildDir
}

Error running Gradle: ProcessException: Process "C:\src\teste1\android\gradlew.bat" exited abnormally:

FAILURE: Build failed with an exception.

What went wrong: A problem occurred configuring root project 'android'. Could not resolve all artifacts for configuration ':classpath'. Could not resolve com.android.tools.build:gradle:3.2.1. Required by: project : Could not resolve com.android.tools.build:gradle:3.2.1. Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.pom'. Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.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.android.tools.build:gradle:3.2.1. Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.pom'. Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.pom'. sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

最佳答案

我在企业互联网代理后面的 Windows 10 上运行 flutter run 时遇到了同样的问题,但在这种情况下没有身份验证。

FAILURE: Build failed with an exception.

What went wrong: Could not resolve all files for configuration ':app:_internal_aapt2_binary'. Could not resolve com.android.tools.build:aapt2:3.2.1-4818971. Required by: project :app Could not resolve com.android.tools.build:aapt2:3.2.1-4818971. Could not get resource 'https://dl.google.com/dl/android/maven2/com/andro Could not GET 'https://dl.google.com/dl/android/maven2/com/android/too sun.security.validator.ValidatorException: PKIX path building faile unable to find valid certification path to requested target Could not resolve com.android.tools.build:aapt2:3.2.1-4818971. Could not get resource 'https://jcenter.bintray.com/com/android/tools/bui Could not GET 'https://jcenter.bintray.com/com/android/tools/build/aap sun.security.validator.ValidatorException: PKIX path building faile unable to find valid certification path to requested target

以下解决方法对我有用。希望对大家有帮助!

  1. 打开您选择的互联网浏览器。
  2. 导航到 https://dl.google.com(注意:它重定向到 https://www.google.com/chrome/ )。
  3. 手动下载证书并将其存储到开发箱。

    Navigate to the URL via your internet browser. Click on the Lock icon in the address bar of the browser. Click on the Certificate menu item in the opened context menu. Change tab to Details. Click "Copy to file..." CTA. Export cert using the export wizard.

  4. 在开发箱上运行 certlm.msc
  5. 导入之前下载的 .cer 文件。
  6. 重新运行 flutter run

关于java - “PKIX 路径构建失败 - 无法找到到请求目标的有效证书路径”(在具有身份验证的公司代理后面),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56245986/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com