Gradle's dependency cache may be corrupt解决方法

Posted 超超boy

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Gradle's dependency cache may be corrupt解决方法相关的知识,希望对你有一定的参考价值。

问题描述:

  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.

解决方法:

1.Delete the .gradle directories both in your home directory and at the top level of your project.
   Gradle\'s cache directoires aren\'t affected by the "Clear caches and restart" option.
   就是删除下面的文件夹:自己目录和项目目录:

    
2.如果上面还没有解决,就下边:
 gradle-wrapper.properties里修改了gradle的版本,与之前没有报错的gradle版本一致。就可以了
 我是改为:
  http\\://services.gradle.org/distributions/gradle-2.10-all.zip

参考:http://stackoverflow.com/questions/27770909/android-studio-gradle-sync-error

以上是关于Gradle's dependency cache may be corrupt解决方法的主要内容,如果未能解决你的问题,请参考以下文章

解决Android Studio出现Failed to open zip file. Gradle's dependency cache may be corrupt的问题

ERROR: Failed to open zip file. Gradle's dependency cache may be corrupt (this sometimes occurs

android studio gradle dependencies 包存放在哪儿?

解决Gradle执行命令时报Could not determine the dependencies of task ':compileReleaseJava'.(示例

Unable to resolve dependency for ':app@debug/compileClasspath' could not resolve com.android

'dependencies'不能应用于'(groovy.lang.Closure)'