Gradle sync failed: Unable to find method after update to Gradle 4.0.0

This may be because of any 3rd party Gradle plugin not supporting the new Tasks API. In my case it was because of greendao Gradle plugin.

If you are using greendao update it to the latest version 3.3.0:

classpath 'org.greenrobot:greendao-gradle-plugin:3.3.0'

Or else you will have to find the plugin that is causing the issue.


Solution for the following error in Android Studio 4.0 while using Gradle Plugin 4.0.0 and Gradle version gradle-6.1.1-all.zip:

Error: Unable to find method 'org.gradle.api.tasks.TaskInputs.property(Ljava/lang/String;Ljava/lang/Object;)Lorg/gradle/api/tasks/TaskInputs;'.

Root-cause: The problem is being originated from the older version of GreenDao Library (earlier than 3.3.0) that does not support Gradle 6.0.0 and Gradle plugin earlier than 3.3.x

Solution: Collected from the release note of Latest build (GreenDao v3.3.0) following support has been added in the latest build: --- Support Android Gradle Plugin 3.3+ APIs. #942 --- Support Gradle 6.0. #1002

After updating the library to 3.3.0 in root build.gradle (project)

classpath 'org.greenrobot:greendao-gradle-plugin:3.3.0'

and in build.gradle module:

implementation "org.greenrobot:greendao:3.3.0"

the issue got resolved.

SPECIAL NOTE: Similar error can be thrown by any other libraries that do not support latest gradle plugin. To identify, which library is causing the problem, you can run:

./gradlew tasks --stacktrace