Could not get unknown property 'classesDir' for main classes

The problem is that either your build.gradle or a plugin referenced in your build.gradle is using a method that was deprecated in Gradle 4 and removed in Gradle 5.

If its your build.gradle then you need to change it from using SourceSetOutput.getClassesDir() to SourceSetOutput.getClassesDirs()

If its a plugin, then possibly you are on an old version and updating to a newer version will fix. If not you might need to contact the plugin author to get a fix, or perhaps submit a pull request

You could run the following to get a better understanding of where the call is being made

gradle build --stacktrace