我将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/