Cause: unable to find valid certification path to requested target 问题解决

Cause: unable to find valid certification path to requested target 

用Android Studio新建了一个project,打开报了这个错误。

问题原因:build 中无法下载对应资源

问题解决:给build 中goole()  和 jcenter() 换掉

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
//        google()
//        jcenter()
        maven { url 'http://maven.aliyun.com/nexus/content/repositories/google' }
        maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter'}
    }
    dependencies {
        classpath "com.android.tools.build:gradle:4.1.0"

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

allprojects {
    repositories {
//        google()
//        jcenter()
        maven { url 'http://maven.aliyun.com/nexus/content/repositories/google' }
        maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter'}
    }
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
这个错误通常是由于Android Studio无法找到有效的证书路径导致的。根据引用\[2\]的分析,这个问题可能是由于Android Studio默认只能以http://的形式进行网络访问,而当以https://的形式去拉取依赖包时会产生冲突,无法访问相应的网址,从而导致无效证书的错误。解决方法是将阿里云云仓镜像包的地址改为https://。\[2\] 另外,根据引用\[3\]的建议,还可以尝试以下两种方法解决这个问题: 1. 导入阿里云仓库的证书,并可以考虑将Google和JCenter的证书也加上。 2. 更换Android Studio编译使用的JAVA环境,不使用Android Studio自带的,而是使用电脑中其他的JDK。 综上所述,你可以尝试以上方法来解决"unable to find valid certification path to requested target"的问题。 #### 引用[.reference_title] - *1* *3* [【干货】解决AndroidStudio报错Cause: unable to find valid certification path to requested target](https://blog.csdn.net/qq_21154101/article/details/107886617)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* [遇到Cause: unable to find valid certification path to requested target的另一种解决思路](https://blog.csdn.net/weixin_43622246/article/details/104905486)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值