【问题标题】:how to resolve 'unable to find valid certification path to requested target' on Android Studio 2.3.2如何在 Android Studio 2.3.2 上解决“无法找到请求目标的有效认证路径”
【发布时间】:2017-10-26 11:37:02
【问题描述】:

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

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

这是我的毕业典礼

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 文件夹解决了这个问题。但是对于这个问题,我找不到解决方案!

【问题讨论】:

    标签: android android-studio ssl android-gradle-plugin gradle-plugin


    【解决方案1】:

    此错误主要发生在我们尝试在没有互联网连接的情况下同步项目的 gradle 时。

    【讨论】:

      【解决方案2】:

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

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

      这里是用于代理设置的 Android 详细信息:

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

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

      你可以在下面的链接https://developer.android.com/studio/intro/studio-config#proxy找到更多细节

      【讨论】:

        猜你喜欢
        • 2014-12-29
        • 1970-01-01
        • 2021-12-04
        • 1970-01-01
        • 1970-01-01
        • 2015-02-13
        • 2019-10-15
        • 2021-06-01
        • 1970-01-01
        相关资源
        最近更新 更多