AndroidManifest.xml
<meta-data android:name="UMENG_CHANNEL" android:value="${UMENG_CHANNEL_VALUE}" />
build.gradle
android { lintOptions { checkReleaseBuilds false // Or, if you prefer, you can continue to check for errors in release builds, // but continue the build even when errors are found: abortOnError false }
productFlavors {
buildTypes{
debug{
local {}
productFlavors.all {
flavor -> flavor.manifestPlaceholders = [UMENG_CHANNEL_VALUE: name]
}
}
release{
应用宝市场 {}
微信市场 {}
百度市场 {}
三六零市场 {}
小米市场 {}
华为市场 {}
productFlavors.all {
flavor -> flavor.manifestPlaceholders = [UMENG_CHANNEL_VALUE: name]
}
}
}
}
}
在debug模式下只生成local_debug.apk用于测试
在release模式下生成各个渠道的apk
在android studio 的命令行下执行 gradlew assembleRelease, 就等着生成吧
参考: http://www.cnblogs.com/0616--ataozhijia/p/4203997.html
参考: https://www.zhihu.com/question/22842123