productFlavors打包安卓app
签名文件配置
signingConfigs { origin { keyAlias 'flavors' keyPassword '123456' storeFile file('签名文件路径/aaa.jks') storePassword '123456' } }
在build.gradle文件里面配置多渠道打包,如果渠道不多直接写在productFlavors{} 里面就好了。这里只添加了2个渠道,通过配置manifestPlaceHolders,添加渠道信息
flavorDimensions ("channel")
productFlavors { origin{ signingConfig signingConfigs.origin manifestPlaceholders = [CHANNEL_VALUE:"origin"]
dimension "channel" } huawei{ signingConfig signingConfigs.origin manifestPlaceholders = [CHANNEL_VALUE:"huawei"]
dimension "channel"
} }
在AndroidManifest文件的aplication标签中添加
<meta-data android:name="channel" android:value="${CHANNEL_VALUE}" />