android - 基于构建类型的 gradle 模块解析
问题描述
一般来说,我对 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"
}
我的问题是
- 我可以在这里关闭有问题的依赖项吗?
- 如果可以的话,我怎么能有条件地只为特定的构建类型这样做?
或者:如果这里不能完成,这是如何完成的?
或者
是否可以通过
resValue("bool", "FIREBASE_MESSAGE_ENABLED", "false")
我不确定在哪里可以找到内置类型中 resValue 允许的值。
提前感谢您提供的所有帮助。
解决方案
debugImplementation "com.url.thing-support:version.subversion"
用于调试 buildType
qaImplementation "com.url.thing-support:version.subversion.1"
对于 qa buildType 等等...
推荐阅读
- angular - 在 eventClick 函数 fullcalendar 上关闭弹出窗口
- visual-studio-code - Visual Studio Code 不会在某些项目上加载帐户
- javascript - 如何在 Next.js 中添加 301 重定向(从 http 到 https)?
- python - 在 C++ 中从串行读取和解释数据
- amazon-web-services - CFN Guard - 基于参数的规则执行
- r - DPLYR 等效于具有多列的 n_distinct
- python - 如何重新训练变分自编码器并重现相同的结果
- python-3.x - UniqueConstraint Django 独一无二
- node.js - 如何将公共 npm 包添加到 Azure DevOps 包源
- javascript - 我正在学习并尝试在控制台中打印这些功能,但总是告诉我未捕获的引用错误:对象未定义