Gradle Build Error in Plugin 3.6.1 and distribution url 5.6.4

I am getting this error when building my project

groovy.lang.MissingMethodException: No signature of method: org.gradle.api.internal.file.DefaultFilePropertyFactory$DefaultDirectoryVar.toPath() is applicable for argument types: () values: []

my gradle script looks like this
newApkName = "${appName}${separator}${output.baseName}${separator}${variant.versionName}.apk" def relativeRootDir = output.packageApplication.outputDirectory.toPath() .relativize(rootDir.toPath()).toFile()

it seems the toPath() method signature has changed. please help

same here. No fun updating to the latest build tools when stuff like this happens :frowning:

Update: I was able to resolve using Chris Parkers answer from this post: https://stackoverflow.com/questions/54206898/variantoutput-getpackageapplication-is-obsolete

Hi, I had a similar problem. I looked at Chris example but couldn’t understand it. Here’s what they said:

"What went wrong:
A problem occurred configuring project ‘:app’.

groovy.lang.MissingMethodException: No signature of method: org.gradle.api.internal.file.DefaultFilePropertyFactory$DefaultDirectoryVar.toPath() is applicable for argument types: () values:
Possible solutions: tap(groovy.lang.Closure), each(groovy.lang.Closure), with(groovy.lang.Closure), with(boolean, groovy.lang.Closure), getAt(java.lang.String), putAt(java.lang.String, java.lang.Object)"