Android studio 导入github下载的项目 报错:Cause: unable to find valid certification path to requested target

目录

一. 前言

二. 分析

1.修改项目文件夹下的build.gradle

2.修改gradle-wrapper.properties

3.修改app文件夹下的build.gradle

三. 后记

1.Annotation processors must be explicitly declared now.  The following dependencies on the compile classpath are found to contain annotation processor.  Please add them to the annotationProcessor configuration.   - compiler-4.6.1.jar (com.github.bumptech.g

2. The minSdk version should not be declared in the android manifest file. You can move th

3.Unable to find method 'org.gradle.api.tasks.compile.CompileOptions.setBootClasspath(Ljava/lang/String;)V'.Possible causes for this unexpected error include:

4.成功运行


 

一. 前言

我曾经在安装as的时候,遇到过这个错误,花了5天才解决(起床、饭前、饭后、睡前都sync一下,一点一点的成功),怎么解决的?没搞明白,我觉得就是网络原因。

导入github项目,又遇到了这个问题,我花了半天多的时间解决了,并且又导入三个不同的项目测试,都成功了。

二. 分析

我新建项目 全是绿的,但导入项目不行,尝试了导入证书方法,卒。

又搜了搜

觉得像是版本配置问题。

首先新建一个新项目(可以跑的)

找到项目文件夹和要导入的项目文件夹

1.修改项目文件夹下的build.gradle

主要是修改这句代码(这是我可以运行的项目)

将待导入项目的对应位置改为 3.5.3

2.修改gradle-wrapper.properties

将待导入项目对应文件中最后一行改为能跑项目对应文件中的最后一行    我的是这样:distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip

3.修改app文件夹下的build.gradle

一定记得是app文件夹下的

修改一下三个地方(必须修改)对照着你那个可以跑的项目

致此,就可以了。

三. 后记

我第一次试的时候,上边三次替换后,就能跑了,但是第二个项目就不行了,还有点小错。

不同的项目配置不一样,有的几年前了,有些东西都被弃用了,这很正常,遇见错误,解决错误。

1.Annotation processors must be explicitly declared now.  The following dependencies on the compile classpath are found to contain annotation processor.  Please add them to the annotationProcessor configuration.   - compiler-4.6.1.jar (com.github.bumptech.g

在app的build中
android {
    ...
    defaultConfig {
        ...
        //添加如下配置就OK了
        javaCompileOptions { annotationProcessorOptions { includeCompileClasspath = true } }
    }

2. The minSdk version should not be declared in the android manifest file. You can move th

点remove就行。

3.Unable to find method 'org.gradle.api.tasks.compile.CompileOptions.setBootClasspath(Ljava/lang/String;)V'.
Possible causes for this unexpected error include:
 

这个地方没有修改造成的。

4.成功运行

遇见错误,解决错误。

想想我安装as的时候,花了五天!

可能bug一时解决不了,但是不可能一世解决不了,放一放,缓一缓,没事就尝试着解决,没准下次就能解决呢!

 

                              假如生活欺骗了你,不要悲伤,不要心急。

                              忧郁的日子里需要镇静,相信吧,快乐的日子将会来临!

                              心儿永远向往着未来,

                              而现在却常是忧郁。

                              一切都是瞬息,一切都将会过去。

                              而那过去了的,就会成为亲切的怀恋。

                                                                         -----普希金

现在读读这首诗,深有感触。

 

 

 

 

 

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值