首页 > 解决方案 > 升级 gradle 到 v6.1.1 找不到方法

问题描述

Unable to find method 'org.gradle.api.tasks.TaskInputs.property(Ljava/lang/String;Ljava/lang/Object;)Lorg/gradle/api/tasks/TaskInputs;'.
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.

标签: android-studiogradle

解决方案


阅读此处的文档很有用,以防任何细节有助于解决问题:

https://docs.gradle.org/current/userguide/upgrading_version_5.html#changes_6.0

我的问题原来与特定的第三方插件有关,Greendao3GradlePlugin.

我也记录了我失败的步骤,以便其他人可以避免不必要的步骤。

./gradlew build失败并出现错误:Failed to notify project evaluation listener.

解决步骤:

  1. 将 JDK 升级到版本 9:无法解决。

  2. 下载并安装JDK 9:无法解决。

  3. 安装 SDK 30.0:无法解决。

  4. 添加configurations.all { resolutionStrategy.capabilitiesResolution.all { selectHighestVersion() } }到 build.gradle:无法解决。

  5. 禁用所有第三方插件:无法解决。

  6. 升级到kotlin-gradle-plugin:1.3.72:无法解决。

  7. ./gradlew --scan build显示错误来自Greendao3GradlePlugin,表明这是一个特定于项目的错误。解决方案是解决这个特定问题。

给有此问题的其他人的建议:使用Gradle Build Scans深入了解您的构建以查找问题第三方插件。


推荐阅读