gpt4 book ai didi

android - 毕业: apply plugin only for specific flavor

转载 作者:IT老高 更新时间:2023-10-28 23:25:00 30 4
gpt4 key购买 nike

我的 Android gradle 目前为使用不同的推送服务设置了 flavor 维度。 (一个用于百度推送,一个用于 GCM)我想让我的 Android 应用程序只导入 google-services 以获得 GCM 推送构建风格。有可能吗?

P.S. 因为为了在 Android 中使用 GCM,我必须在 apply plugin: 'com.google.gms.google-services' 行我的 app/build.gradle 文件的底部,详细 here .

为了让百度风格构建成功,我可能需要为百度放置一个虚拟 google-services.json

更新:我似乎在 this 中找到了答案长 github 问题线程。

最佳答案

在您的 build.gradle(App) 文件中添加以下代码:

if (getGradle().getStartParameter().getTaskRequests()
.toString().contains("YourGCMFlavorName")){
apply plugin: 'com.google.gms.google-services'
}

N.B.: First letter of flavor name must be in Uppercase

2021-11-23 更新:请注意 the solution下面是 Prasoon Abhishek。

关于android - 毕业: apply plugin only for specific flavor,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39651693/

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