无法使用 gradle 插件 3.3 覆盖清单

2024-01-02

这基本上是我写的文本的副本这个问题 https://issuetracker.google.com/issues/123893861

任何帮助,将不胜感激:

我正在尝试将我的项目升级到 gradle 插件 3.3 w/ gradle 4.10.1,但我的构建失败并出现以下错误

  • What went wrong: Execution failed for task ':main:processDebugManifest'.

    java.io.FileNotFoundException: /main/property(接口 org.gradle.api.file.Directory, 转换(属性(接口 org.gradle.api.file.Directory, 固定(类 org.gradle.api.internal.file. DefaultProjectLayout$FixedDirectory, /main/build))))/AndroidManifest.xml (没有这样的文件或目录)

我的代码与这里的代码相同 -https://developer.android.com/studio/known-issues#variant_api https://developer.android.com/studio/known-issues#variant_api在“manifestOutputFile不再可用”下

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()
...
        }
    }
}

这是产生错误的行 -

def manifestContent = file(manifestPath).getText()

Update:尝试了下面评论中建议的解决方案这个答案 https://stackoverflow.com/a/35537506/2482564并得到以下错误

  • 什么地方出了错: 任务“:main:processDebugManifest”执行失败。 找不到匹配的构造函数:java.io.File(org.gradle.api.internal.file.DefaultProjectLayout$DefaultDirectoryVar, java.lang.String)

def outputDir = manifestOutputDirectory
File directory
if (outputDir instanceof File) {
    directory = outputDir
} else {
    directory = outputDir.get().asFile
}

String manifestPath = directory.toString() + "/AndroidManifest.xml"
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

无法使用 gradle 插件 3.3 覆盖清单 的相关文章

随机推荐