Gradle的依赖缓存可能已经损坏(这有时会在网络连接超时后发生)。

113

我收到了这种错误,如何修复它。

Error:Unable to load class 'org.gradle.tooling.internal.protocol.test.InternalTestExecutionConnection'.
Possible causes for this unexpected error 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.In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.

请检查我的答案。在我的情况下,这是JDK路径问题。 https://dev59.com/75jga4cB1Zd3GeqPI1v0#44583007 - Ajji
当您的Gradle下载中途断开互联网连接时,会出现问题。因此,请转到C:\ Users \ your username \ .gradle \ wrapper \ dists \ gradle-6.5-bin并删除zip文件。重新打开项目,Gradle将开始再次下载100MB文件。 - Abdul Wahid
41个回答

-1
这是我的情况:我必须使用另一个Android Studio版本(3.2.1),Gradle版本为4.6。为此,我下载了Android Studio的.zip版本。起初它不起作用,即使我创建了一个新项目,Gradle也无法工作。但经过一些研究和从这些帖子中获得的一些帮助后,我做了以下操作:
  1. 我进入了我的gradle文件路径(android-studio\gradle)并删除了所有的gradle-4.6文件。
  2. 然后我去到gradle-wrapper.properties,获取我需要的Gradle版本(gradle-4.6-all.zip)。
  3. 我去gradle site查找我需要的版本。
  4. 下载并解压到我的Android Studio的gradle文件路径中,参见步骤1。
  5. 我进入Android Studio设置(文件/设置/Gradle),将选项“使用默认gradle wrapper(推荐)”更改为“使用本地gradle分发”
  6. 我选择了我下载的Gradle版本所在的路径,即步骤4,并应用了更改。
  7. 以防万一,我使用了“无效缓存/重启”选项(文件/“无效缓存/重启”)。
  8. 之后我使用了“同步项目和Gradle文件”,成功了!

顺便说一下,我正在使用Android Studio 3.2.1 zip版本。当我尝试使用旧版Android Studio创建项目时,也遇到了同样的问题。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接