'manifestoutputdirectory' With Gradle-plugin 3.3.0 Not Returning Result
Trying to get manifest output directory, with below code in app build.gradle def manifestOutDir = manifestOutputDirectory But instead of returning directory path, when I run build
Solution 1:
This post [https://stackoverflow.com/a/46037817/4181904] indicates that this feature is broken.
Essentially, instead of accessing the outputFile directly from the gradle API, the recommendation is to access the directory containing the file instead. The snippet below demonstrates this with a manifest file, but can be applied to other outputFiles as well.
android.applicationVariants.all { variant ->
variant.outputs.all { output ->
output.processManifest.doLast {
String manifestPath = "$manifestOutputDirectory/AndroidManifest.xml"
def manifestContent = file(manifestPath).getText()
// Manipulate the file as needed
}
}
}
Solution 2:
In high gradle version maybe above 3.3 , the Library's AndroidManifest.xml
is moved from package .../merged_manifests
to .../library_manifest
. So if you use this code to get the path will not work. More detail you could see Android Plugin for Gradle 3.0.0
def manifestPath = manifestOutputDirectory.asFile.get()
NOW, You should just use this to get the AndroidManifest.xml
:
def manifest = manifestOutputFile.asFile.get()
Have fun 😎
Post a Comment for "'manifestoutputdirectory' With Gradle-plugin 3.3.0 Not Returning Result"