报错信息:

ERROR: Unable to resolve dependency for ':[email protected]/compileClasspath': Could not download gson.jar (com.google.code.gson:gson:2.8.6)

Show Details

Affected Modules: app

Unable to resolve dependency for ':[email protected]/compileClasspath': Could not download gson.jar

方法一:选中NO proxy

Unable to resolve dependency for ':[email protected]/compileClasspath': Could not download gson.jar

方法二:注释掉gradel.properties中的代理代码。

方法三:Cache/Restart。

  1. Go to "File".
  2. Click on Invalidate Cache/ Restart.
  3. Again click on Invalidate Cache / Restart(On dialoge window).

方法四:将前面一个修改为后面一个

implementation fileTree(include: ['*.jar'])

to

// implementation or compile

implementation fileTree(include: ['*.jar'], dir: 'libs')

方法五:在build.gradle (app)中增加如下,

dexOptions {
    // release & debug is in project animators
    matchingFallbacks = ['release', 'debug']
}
debug {

}

方法六:是否版本问题,切换其它版本试下。(成功解决我的问题)。

将gson最新的2.8.6修改为2.7则成功。

 

参考文章:

https://blog.csdn.net/leol_2/article/details/84785626

https://stackoverflow.com/questions/51218535/unable-to-resolve-dependency-for-appdebug-compileclasspath-could-not-resolv

https://www.cnblogs.com/yuyuan-bb/p/11562054.html

相关文章: