android studio批量打包
1.配置AndroidManifest.xml中要替换的变量
<meta-data android:name="UMENG_CHANNEL" android:value="${UMENG_CHANNEL_VALUE}" />
2.在build.gradle设置productFlavors
android { productFlavors { xiaomi {} baidu {} wandoujia {} } productFlavors.all { flavor -> flavor.manifestPlaceholders = [UMENG_CHANNEL_VALUE: name] } }
3.配置签名证书
signingConfigs { release { storeFile file("test.jks") storePassword "pass" keyAlias "test" keyPassword "pass" } }
4.在Terminal中执行命令gradlew assembleRelease
5.成功后在app–>build–>outputs–>apk目录就可以看到打好的包喽