更新到Gradle4.2.0后,单元测试中出现清单占位符错误

将 'com.android.tools.build:gradle' 从版本 4.1.3 更新到 4.2.0 后,我开始收到一个错误,即在运行单元测试时,'manifestPlaceholders' 不再合并到清单中。当我运行应用程序时,一切正常。它只是在运行测试时失败。

defaultConfig {
    (...)
    manifestPlaceholders = [
            myPlaceholder1: "some_value_1",
            myPlaceholder2: "some_value_2"
    ]
}

“test”文件夹中的任何单元测试现在都失败并显示以下消息:

> Task :myLib:processDebugUnitTestManifest FAILED
/myProject/source/android/myProject/build/intermediates/tmp/manifest/test/debug/manifestMerger684952061703372993.xml Error:
    Attribute attribute1 at manifestMerger684952061703372993.xml requires a placeholder substitution but no value for <myPlaceholder1> is provided.
/myProject/source/android/myProject/build/intermediates/tmp/manifest/test/debug/manifestMerger684952061703372993.xml Error:
    Attribute attribute2 at manifestMerger684952061703372993.xml requires a placeholder substitution but no value for <myPlaceholder2> is provided.

我不得不再次降级到 4.1.3 版。任何人都有任何解决方案?

以上是更新到Gradle4.2.0后,单元测试中出现清单占位符错误的全部内容。
THE END
分享
二维码
< <上一篇
下一篇>>