提问者:小点点

Gradle构建失败-Android Studio 4.0


我正在尝试打开一个旧项目到android工作室,得到这个Gradle错误

Unable to find method 'org.gradle.api.tasks.compile.CompileOptions.setBootClasspath(Ljava/lang/String;)V'.
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.

In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.

共1个答案

匿名用户

正如梯度误差所述:

Gradle的依赖项缓存可能已损坏(这有时发生在网络连接超时之后。) 重新下载依赖项并同步项目(需要网络)

Gradle生成进程(守护进程)的状态可能已损坏。 停止所有Gradle后台进程可能会解决这个问题。 停止梯度生成进程(需要重新启动)

按照以下步骤操作:

>

  • 关闭Android Studio并杀死Android Studio的所有进程

    • mac=>; 按Command+Option+Esc,然后强制停止Android Studio进程
    • Windows=>; Ctrl+Alt+Del键盘快捷键并单击“任务管理器”,然后单击“更多详细信息”按钮以显示所有正在运行的进程。

    再次运行Android Studio

    请确保您有活动且工作的internet连接,然后再次尝试生成项目