android - Android Studio 3.4/Gradle v5更新错误

标签 android android-studio gradle android-gradle-plugin gradle-plugin

我将Android Studio的版本更新为3.4,然后要求我将Gradle从v4.10.1升级到v5.1.1。

但是gradle项目同步现在仍然失败:

ERROR: Unable to find method 'org.gradle.api.tasks.SourceSetOutput.getClassesDir()Ljava/io/File;'.

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.



我已经尝试了所有这些选项,但是仍然遇到相同的错误。我发现了以下有关从v4升级到v5的信息:

The classesDir property has been removed from both the JDepend task and SourceSetOutput. Use the JDepend.classesDirs and SourceSetOutput.classesDirs properties instead.



https://docs.gradle.org/current/userguide/upgrading_version_4.html

它提供的唯一有用的信息是使用提及的属性。但是我不知道需要替换什么,我看不到SourceSetOutput在代码的任何地方使用。我不认为其他人会遇到此问题,或者不知道如何解决此问题?

我还尝试了升级到最新的Gradle版本5.4.1,但这似乎没有什么不同。

最佳答案

只需将Android Studio更新为3.4稳定版本即可。这对我有用:)

关于android - Android Studio 3.4/Gradle v5更新错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56040130/

相关文章:

android - 在 Windows 上使用 NDK r10 为 android 编译 ffmpeg 2.3

Android - 打开 FB native 应用程序时找不到处理 Intent 的 Activity

android-studio - Android Studio中有添加Flutter pub包的快捷方式吗?

android - 如何在android studio中启用dex编译器D8(Next-generation Dex Compiler)

android - 如何在 gradle 中创建动态 url?

android - 在Android Gradle Dependency中编译多个模块

android - 从 Android Wear 获取心率

android - 文字转语音停止问题

android - 将项目拆分为模块

android - 每次我运行应用程序时,我都会遇到gradle错误