【问题标题】:Android Studio: unable to find valid certification path to requested targetAndroid Studio:无法找到请求目标的有效认证路径
【发布时间】:2018-07-16 12:36:32
【问题描述】:

我正在空白安装 Android Studio,然后我制作了一个新的 Android 应用程序。尝试调试后,我得到“无法找到请求目标的有效证书路径”。

现在我正在寻找解决方案,但更改 cacerts 文件对我不起作用。

app/build.gradle:

apply plugin: 'com.android.application'
android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.example.da_ma.myapplication"
        minSdkVersion 17
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'
    implementation 'com.android.support:design:28.0.0-alpha3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

应用程序 build.gradle:

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.3'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}
allprojects {
    repositories {
        google()
        jcenter()
    }
}
task clean(type: Delete) {
    delete rootProject.buildDir
}

原因:无法找到请求目标的有效认证路径

有什么想法吗?

【问题讨论】:

  • 我在使用 gradle 时遇到了类似的问题,这与我们的办公室防火墙策略有关。当我们将 gradle 调用的 url 列入白名单时,它就开始工作了。
  • 啊,好吧,所以当我在另一个网络中尝试这个时,它应该可以工作。我会测试。

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


【解决方案1】:

在 build.gradle 中将所有 https 更改为 http 对我有用。 例如:-

   maven {
        url "https://github.com/QuickBlox/quickblox-android-sdk-releases/raw/master/"
    }

收件人:-

 maven {
        url "http://github.com/QuickBlox/quickblox-android-sdk-releases/raw/master/"
    }

希望它也适用于其他人。

【讨论】:

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