【发布时间】:2020-10-23 04:57:14
【问题描述】:
总的来说,我对 Android 开发和 gradle 配置还很陌生,但同样的任务是应对这一挑战。我需要根据构建类型禁用特定的插件/模块(很抱歉甚至不知道该怎么称呼它)。
更多信息是我要禁用的依赖项是 firebase 依赖项。不确定这是否重要,但我也将其添加到问题中。
我们有如下类型:
debug {
...code here
}
qa {
...code here
}
release {
...code here
}
stage {
...code here
}
sft {
...code here
}
sandbox {
...code here
}
然后我们有如下依赖:
dependencies {
... dependencies that need to be there
// these are the main concerns
Implementation "com.google.firebase:firebase-messaging:11.0.4"
Implementation "com.google.firebase:firebase-analytics:11.0.4"
}
我的问题是
- 我可以在此处关闭相关依赖项吗?
- 如果可以的话,我怎样才能有条件地只针对特定的构建类型这样做?
或者: 如果这里都做不到,那怎么做呢?
或
是否可以通过以下方式禁用 Firebase 消息传递
resValue("bool", "FIREBASE_MESSAGE_ENABLED", "false")
我不确定在哪里可以找到构建类型中 resValue 允许的值。
提前感谢所有帮助。
【问题讨论】: