0

Trying to build Android project in intellij idea and getting following error: Build file 'C:\Users...\app\build.gradle' line: 91

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: each(groovy.lang.Closure), tap(groovy.lang.Closure), with(groovy.lang.Closure), with(boolean, groovy.lang.Closure), getAt(java.lang.String), putAt(java.lang.String, java.lang.Object)

applicationVariants.all { variant ->
    variant.outputs.each { output ->
        def project = "Demo"
        def flavourName = variant.flavorName
        def variantName = "Build"
        def apkName = project + "-" + flavourName + "-" + variantName + "-" + versionName + ".apk"
        def relativeRootDir = variant.packageApplicationProvider.get().outputDirectory.toPath()
                .relativize(rootDir.toPath()).toFile()    // <-- error line   
        output.outputFileName = new File("$relativeRootDir/release", apkName)
    }
}

How to solve this? what should I change?

003
  • 197
  • 1
  • 12
  • 1
    Check this [Gradle discussion thread](https://discuss.gradle.org/t/gradle-build-error-in-plugin-3-6-1-and-distribution-url-5-6-4/35328) which leads to the suggestion here: https://stackoverflow.com/a/56164030/2000323 – Andrey May 28 '20 at 13:21
  • @Andrey this was right. it resolved my issue. – 003 May 29 '20 at 16:23

0 Answers0