标签:android android studio gradle
// 多渠道打包
def channels() {
if (project.hasProperty("channel")) {
// 渠道号配置文件路径
def path = "./build-types/channels.txt"
file(path).eachLine { line ->
if(!line.startsWith("//")){ //剔除注释行
android.buildTypes.create(line, {
manifestPlaceholders = [ channel:line ]
})
}
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.tubb.cityindex" >
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.tubb.cityindex.CitySelectorActivity"
android:label="@string/app_name" >
<intent-filter><meta-data android:name="UMENG_CHANNEL" android:value="${channel}"/>
</application>
</manifest>// 百度应用市场 baidu // 360应用市场 m360
标签:android android studio gradle
原文地址:http://blog.csdn.net/tu_bingbing/article/details/42362619