android gradle 插件提供了 android.applicationVariants 索引来遍历所有的 build variant 后来,我们采取了一个方案,遍历 Build Variant,设置 extension 信息来兼容这种需求。
if (variant.name.contains("debug")) {
bugtagsAppKey = 'APP_KEY_BETA'
bugtagsAppSecret = 'APP_SECRET_BETA'
} else if (variant.name.contains("release")) {
bugtagsAppKey = 'APP_KEY_LIVE'
bugtagsAppSecret = 'APP_SECRET_LIVE'
}
variant.ext.bugtagsAppKey = bugtagsAppKey
variant.ext.bugtagsAppSecret = bugtagsAppSecret
}
}
apply plugin: 'com.bugtags.library.plugin' ```
网友评论