Could not resolve all artifacts for configuration ':classpath'.

“org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$Artifact” Could not resolve all artifacts for configuration ':classpath'.

从网上搜了很多的办法,大多是在build.gradle里加上阿里云的镜像或者其他的镜像

反正我试了这些办法后都没用,用了我一上午的时间都没整好他,大家可以试试

https://blog.csdn.net/m0_46278918/article/details/105812376

https://blog.csdn.net/wwongcong/article/details/99597655

https://blog.csdn.net/X_kine/article/details/104741771

最后我是无意间看到了一个评论,他给出了一个解决办法,我就抱着试试的态度,结果还真解决了

解决办法:

1、首先修改根目录下的build.gradle成如下格式

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
  repositories {
  }
  dependencies {
    classpath 'com.android.tools.build:gradle:3.6.1'
 
    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
  }
}
allprojects {
  repositories {
//    google()
//    jcenter()
  }
}

2、然后点击sync project with gradle files,如下图所示

3、 如果再次报错请清理缓存并重启AS,方法如下图

 

4、(最重要的步骤)如果再次报错,请不厌其烦的且厚不要脸的多次点击这个小象(即重复第二步操作),正常情况下奇迹会发生的。(反正我是见证该奇迹了)

到此这篇关于解决Android studio 3.6.1 出现Cause: unable to find valid certification path to requested target

参考文章:https://www.jb51.net/article/182527.htm

原文地址:https://www.cnblogs.com/022414ls/p/13469136.html