1. build -> Generate Signed APK
2. next -》 next
3. 多渠道打包
<meta-data
android:name="UMENG_CHANNEL"
android:value="${UMENG_CHANNEL_VALUE}" />
signingConfigs {
debug {
keyAlias 'curiousby'
keyPassword '123456'
storeFile file('C:\\Users\\cmcc-B100036\\Desktop\\android\\iteyeblog-as\\iteyeblog-as.jks')
storePassword '123456'
}
release {
keyAlias 'curiousby'
keyPassword '123456'
storeFile file('C:\\Users\\cmcc-B100036\\Desktop\\android\\iteyeblog-as\\iteyeblog-as.jks')
storePassword '123456'
}
}
buildTypes {
// 打测试包
debug{
// 显示Log
buildConfigField "boolean", "DEBUG_ENABLE", "true"
// versionNameSuffix "-debug"
minifyEnabled false
zipAlignEnabled false
shrinkResources false
signingConfig signingConfigs.debug
}
// 打正式包
release {
// 不显示Log
buildConfigField "boolean", "DEBUG_ENABLE", "false"
// 启用混淆
minifyEnabled false
// Zipalign优化
zipAlignEnabled true
// 移除无用的resource文件
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
// 签名
signingConfig signingConfigs.release
// 修改文件名
applicationVariants.all { variant ->
variant.outputs.each { output ->
def outputFile = output.outputFile
if (outputFile != null && outputFile.name.endsWith('.apk')) {
// 输出apk名称为IteyeBlog_v1.0_2016-07-31_wandoujia.apk
def fileName = "IteyeBlog_${defaultConfig.versionName}_${variant.productFlavors[0].name}.apk" //_${releaseTime()}
output.outputFile = new File(outputFile.parent, fileName)
}
}
}
}
}
// 配置渠道包
productFlavors {
MAIN {
manifestPlaceholders = [UMENG_CHANNEL_VALUE: "MAIN"]
}
WANDOUJIA {
manifestPlaceholders = [UMENG_CHANNEL_VALUE: "WANDOUJIA"]
}
BAIDU {
manifestPlaceholders = [UMENG_CHANNEL_VALUE: "BAIDU"]
}
QIHU360 {
manifestPlaceholders = [UMENG_CHANNEL_VALUE: "QIHU360"]
}
XIAOMI {
manifestPlaceholders = [UMENG_CHANNEL_VALUE: "XIAOMI"]
}
YINGYONGBAO {
manifestPlaceholders = [UMENG_CHANNEL_VALUE: "YINGYONGBAO"]
}
}
点击 task
4. 使用 eclipse 签名 打包
signingConfigs {
debug {
keyAlias 'baoyou'
keyPassword '123456'
storeFile file('C:\\Users\\cmcc-B100036\\Desktop\\android\\android-cmcc-B100036')
storePassword '123456'
}
release {
keyAlias 'baoyou'
keyPassword '123456'
storeFile file('C:\\Users\\cmcc-B100036\\Desktop\\android\\android-cmcc-B100036')
storePassword '123456'
}
}
捐助开发者
在兴趣的驱动下,写一个免费
的东西,有欣喜,也还有汗水,希望你喜欢我的作品,同时也能支持一下。 当然,有钱捧个钱场(支持支付宝和微信捐助,加入it技术扣扣群),没钱捧个人场,谢谢各位。
谢谢您的赞助,我会做的更好!