I am trying to upgrade gradle version and getting the following error
'getter for buildDir: File!' is deprecated. Deprecated in Java
But not able to find an alternate solution to this anywhere.
My code that is using buildDir is like this
"${this@allprojects.buildDir/path}"
You now need to use:
layout.buildDirectory
See the version 8 upgrade instructions.
This will give you a DirectoryProperty
rather than a Java File
(using Gradle's lazy configuration API).
You will then have to use further methods to use it. Calling get().getAsFile()
will immediately access the File
object, but you should use the it lazily wherever possible (so Gradle can complete the project configuration smoothly).