gpt4 book ai didi

android - 更改 androidTest list 中的 manifestPlaceholders

转载 作者:太空狗 更新时间:2023-10-29 13:50:16 25 4
gpt4 key购买 nike

我有服务的 list 占位符:

<service
android:name=".MyService"
android:process="${processName}">

在我的 build.gradle 中我替换了它。

android {  
defaultConfig {
manifestPlaceholders = [
processName: ':Proc'
]
}
}

但对于我的 Espresso 测试 (androidTest),我需要在 processName 中设置空值。我该怎么做?

我已经尝试使用 buildTypes 来做到这一点,但它不起作用(BuildType 名称不能以“androidTest”开头)

最佳答案

此示例适用于 Gradle 插件 3.4.1:

android {
unitTestVariants.all {
it.mergedFlavor.manifestPlaceholders += [
placeHolderName: "placeHolderValue"
]

it.mergedFlavor.addResValue(new ClassFieldImpl("string", "resValueName", "resValueValue"))
}
}

关于android - 更改 androidTest list 中的 manifestPlaceholders,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48866074/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com