gradle-plugin 3.3.0的'manifestOutputDirectory'不返回结果 [英] 'manifestOutputDirectory' with gradle-plugin 3.3.0 not returning result
问题描述
尝试获取清单输出目录,并在应用程序build.gradle中使用以下代码
Trying to get manifest output directory, with below code in app build.gradle
def manifestOutDir = manifestOutputDirectory
但是当我运行build并打印它时,它不会返回目录路径,而是显示此字符串
But instead of returning directory path, when I run build and print it, it shows this string
property(interface org.gradle.api.file.Directory, transform(property(interface org.gradle.api.file.Directory,
...
我正在使用gradle-plugin-3.3.0与 Android Studio 3.3
I am using gradle-plugin-3.3.0 with Android Studio 3.3
它是否不适用于gradle-android-plugin-3.3.0或已删除?我还有什么想念的吗?
Is it not working with gradle-android-plugin-3.3.0 or removed? Anything else that I am missing?
推荐答案
此帖子[ https://stackoverflow.com/a/46037817/4181904] 表示此功能已损坏.
This post [https://stackoverflow.com/a/46037817/4181904] indicates that this feature is broken.
本质上,建议不要访问直接从gradle API中访问outputFile的建议,而是访问包含该文件的目录.下面的代码段使用清单文件对此进行了演示,但也可以将其应用于其他outputFiles.
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
}
}
}
这篇关于gradle-plugin 3.3.0的'manifestOutputDirectory'不返回结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!