1. 程式人生 > 實用技巧 >Could not resolve all artifacts for configuration ':classpath'.

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 { 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:3.6.1' // 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'} } }

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