一迅诬、修改AS代碼
1董饰、AndroidManifest.xml
<application
android:icon="${APP_ICON}"
>
2岳锁、build.gradle
andriod{
···
def DEF_APP_ICON = "@drawable/icon"
productFlavors.all {
flavor ->
flavor.manifestPlaceholders =
[TD_CHANNEL_VALUE: name, //渠道名
APP_ICON :project.hasProperty("cusAppIcon") ? cusAppIcon : DEF_APP_ICON] //App_Icon
}
}
3、二吊输、logo改名稱
如:應(yīng)用寶渠道則改名為 icon_yingyongbao
三饶号、配置Jenkins
1、添加參數(shù)
- appLogo
- @drawable/icon
- 此處填寫前綴為 "@drawable/"(不需要雙引號) + 圖片文件名稱(不需要 .jpg / .png 等文件名后綴)季蚂。渠道在給開發(fā)logo圖片的時候,命名在后面加上后綴茫船,如 icon_oppo.png。 打包的時候填寫"@drawable/icon_oppo"(不需要雙引號) 扭屁。
添加參數(shù)
2算谈、構(gòu)建
echo "build start ${appName}, ${versionName}, ${versionCode}, ${appLogo} ${channel}"
加入 ${appLogo} 這個字段
./gradlew -PcusAppName=${appName}
-PcusVersionName=${versionName}
-PcusVersionCode=${versionCode}
-PcusAppIcon=${appLogo} assemble${nch}Release
加入-PcusAppIcon=${appLogo} 這個字段
使用Jenkins打包
自動化打包
后續(xù)
后續(xù)需要更換AppIcon的時候,可以直接將圖片上傳到服務(wù)器中再進行打包料滥,如圖
上傳文件