【问题标题】:Gradle error after updating Android Studio to 1.5将 Android Studio 更新到 1.5 后出现 Gradle 错误
【发布时间】:2024-04-30 12:30:02
【问题描述】:

今天我已将我的 Android Studio 更新到 v1.5。在此更新之前,我的 libgdx 项目运行良好。现在我收到此错误消息。

    Error:Unable to load class 'org.gradle.mvn3.org.sonatype.aether.resolution.ArtifactResolutionException'.
Possible causes for this unexpected error include:<ul><li>Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
<a href="syncProject">Re-download dependencies and sync project (requires network)</a></li><li>The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.
<a href="stopGradleDaemons">Stop Gradle build processes (requires restart)</a></li><li>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.</li></ul>In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.

我尝试删除 .gradle 文件夹,重新启动 Android Studio,清理项目,但我得到了同样的错误。

感谢您的帮助

【问题讨论】:

  • 您使用的是什么操作系统?我使用的是 Ubuntu,但在升级到 Android Studio 1.5 时遇到了问题。
  • @Little Child Windows 8.1

标签: android android-studio gradle libgdx


【解决方案1】:

我只需要更新主 gradle 文件中的 gradle build tool

    classpath 'com.android.tools.build:gradle:1.3.0'
    classpath 'org.robovm:robovm-gradle-plugin:1.0.0-beta-04'

到:

    classpath 'com.android.tools.build:gradle:1.2.3'
    classpath 'org.robovm:robovm-gradle-plugin:1.9.0'

【讨论】:

  • 你指的是什么文件?我在任何 gradle 文件中都看不到类路径
  • 我的情况是,我将类路径 'org.robovm:robovm-gradle-plugin:1.9.0' 更新为 1.9(gradle 是 2.0)并且它可以工作。谢谢
【解决方案2】:

可能与 Gradle 和 maven 版本不兼容 删除项目目录/gradle/wrapper 将正确版本的 gradle 放入其中 再次运行

https://github.com/dcendents/android-maven-gradle-plugin

【讨论】: