This is basically a copy of the text that I wrote in this issue
Any help would be appreciated:
I'm trying to upgrade my project to gradle plugin 3.3 w/ gradle 4.10.1 and my build fails with the following error
- What went wrong:
Execution failed for task ':main:processDebugManifest'.
java.io.FileNotFoundException: /main/property(interface org.gradle.api.file.Directory, transform(property(interface org.gradle.api.file.Directory, fixed(class org.gradle.api.internal.file.DefaultProjectLayout$FixedDirectory, /main/build))))/AndroidManifest.xml (No such file or directory)
my code is identical to the code here - https://developer.android.com/studio/known-issues#variant_api under "manifestOutputFile is no longer available"
android.applicationVariants.all { variant ->
variant.outputs.all { output ->
output.processManifest.doLast {
// Stores the path to the maifest.
String manifestPath = "$manifestOutputDirectory/AndroidManifest.xml"
// Stores the contents of the manifest.
def manifestContent = file(manifestPath).getText()
...
}
}
}
and this is the line that produces the error -
def manifestContent = file(manifestPath).getText()
Update: tried the solution suggested in the comment below this answer and got the following error
- What went wrong: Execution failed for task ‘:main:processDebugManifest’. Could not find matching constructor for: java.io.File(org.gradle.api.internal.file.DefaultProjectLayout$DefaultDirectoryVar, java.lang.String)
Try replacing
String manifestPath = "$manifestOutputDirectory/AndroidManifest.xml"
with
String manifestPath = new File(output.processManifest.manifestOutputDirectory.get().asFile, "AndroidManifest.xml")