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

The Sync output says the following:
"
Possible causes for this unexpected error include:

  1. Gradle’s dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
    Solution: Re-download dependencies and sync project (requires network) - Tried, still does not work

  2. The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.
    Solution: Stop Gradle build processes (requires restart) - Tried, still does not work

  3. 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.

  4. In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes. - Tried, still does not work
    "

For the third point above, I am using the following third party plugins with which I was able to sync the gradle build files on gradle 3.3 (android gradle plugin 2.3.3):
compile ‘com.google.dagger:dagger:2.23.1’
annotationProcessor ‘com.google.dagger:dagger-compiler:2.23.1’

compile 'com.jakewharton.timber:timber:4.7.1'
compile 'org.greenrobot:eventbus:3.0.0'
compile 'com.jakewharton:butterknife:10.1.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.1.0'

I have now upgraded to gradle 5.4.1 and android gradle plugin 3.4.1, and it fails to build. Could anyone please help me out of this?

Thank you!
Ameya

See Could not get unknown property 'classesDir' for main classes

Did you resolve this? I’m facing exact same issue. when I’m trying to upgrade from gradle 4.5.1 to gradle 5.6.4.

Please let me know.

Same, typical AS… I think they break something every couple of days. I really think we should have to manually change things but it appears that’s where this is headed. I did a complete unistall reinstall same issue.

1 Like

I am also getting the same error - Unable to find method ‘org.gradle.api.internal.file.DefaultSourceDirectorySet.(Ljava/lang/String;Ljava/lang/String;Lorg/gradle/api/internal/file/FileResolver;Lorg/gradle/api/internal/file/collections/DirectoryFileTreeFactory;)V’.

After upgrading fro gradle 5.6.4 to 6.1.1. Can anyone please help?