gpt4 book ai didi

android - 如何在 Android Studio 2.3.2 上解析 'unable to find valid certification path to requested target'

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:01:07 27 4
gpt4 key购买 nike

当我尝试创建 Empty Activity 项目时,我在 Android Studio 2.3.2 中遇到以下错误。当我尝试导入项目时,我也会得到这个。

Error:Cause: unable to find valid certification path to requested target

这是我的gradle

buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.2'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

allprojects {
repositories {
jcenter()
}
}

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

apply plugin: 'com.android.application'

android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "com.example.myapplication"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
}

我也试过用

替换 jcenter()
 jcenter {
url "http://jcenter.bintray.com/"
}

或者

maven  {
url "http://repo1.maven.org/maven2"
}

我的 gradle 分发 url 指向最新

distributionUrl=https://services.gradle.org/distributions/gradle-3.3-all.zip

我已经检查了不同论坛中的许多主题,但无法从中解决我的问题。

  1. Android Studio - Unable to find valid certification path to requested target
  2. Error:Cause: unable to find valid certification path to requested target

编辑:由于 Android 社​​区似乎非常不活跃,我现在该怎么办?评论区有人请至少和我一样。

在我的另一台机器上,这个错误是用一个 URL 显示的。我通过手动下载后将 jar 放入 libs 文件夹来解决这个问题。但是对于这个问题,我找不到解决办法!

最佳答案

这为时已晚,但我遇到了同样的问题并已解决。

我遇到这个问题是因为我在公司代理(Office PC)后面运行 Android Studio。在这种情况下,您必须在 Android Studio 中设置代理。

以下是 Android 代理设置的详细信息:

Android Studio 支持 HTTP 代理设置,因此您可以在防火墙或安全网络后面运行 Android Studio。在 Android Studio 中设置 HTTP 代理设置:

  1. 在菜单栏中,点击文件 > 设置(在 Mac 上,点击 Android Studio > 首选项)。
  2. 在左 Pane 中,点击外观和行为 > 系统设置 > HTTP 代理。出现 HTTP 代理页面。
  3. 选择“自动检测代理设置”为代理设置使用自动代理配置 URL,或选择“手动代理配置”自行输入每个设置。有关这些设置的详细说明,请参阅 HTTP Proxy .
  4. 单击“应用”或“确定”以使您的更改生效。

您可以在下面的链接中找到更多详细信息 https://developer.android.com/studio/intro/studio-config#proxy

Please refer attached screenshot (put your host name and port number while configuration)

关于android - 如何在 Android Studio 2.3.2 上解析 'unable to find valid certification path to requested target',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44186944/

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