Android Studio之Gradle手动下载

Gradle下载

今天实验的时候,突然发生了gradle下载失败的问题,于是来调查下解决办法。

错误信息:

Error:Unable to find method 'com.google.common.cache.CacheBuilder.build(Lcom/google/common/cache/CacheLoader;)Lcom/google/common/cache/LoadingCache;'.
Possible causes for this unexpected error include:
Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
Re-download dependencies and sync project (requires network)
The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.
Stop Gradle build processes (requires restart)
Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.

解决办法一

删除下面的文件夹:自己目录和项目目录


解决办法二

下载gradl

使用迅雷等下载gradle版本后,解压到指定目录下。

下载版本查看:


直接复制上图的连接,到迅雷中打开网页,就会自动下载。

安装

打开Android Studio自动生成文件夹/.gradle/wrapper/dists/gradle-2.14.1-all/8bnwg5hd3w55iofp58khbp6yv

当Android Studio下载过gradle-2.14.1-all之后(不管成功失败),就会在C:/Users/用户名/.gradle/wrapper/dists(或自己修改的.gradle缓存目录/wrapper/dists)中出现gradle-2.14.1-all文件夹.

打开之后是一串以无规律字符命名的文件夹,我的是8bnwg5hd3w55iofp58khbp6yv,这个可能因人而异。

接下来开始操作:

  • 将下载好的压缩包和解压后的文件夹复制到上述文件夹下:
  • 删除gradle-2.14.1-all.zip.part
  • 复制一份gradle-2.14.1-all.zip.lck文件,重命名为gradle-2.14.1-all.zip.ok;
  • 重启as。
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章