不同图标和不同应用名 适用于多平台上传问题
不同意包名 适用于马甲包
不同版本名 适用于多平台版本不同问题
不同应用图标、不同包名、不同版本名、不同签名。适用于一套代码打出多个应用
本文主要使用gradle执行
打出不同应用名,不同应用图标的包
flavorDimensions "nade"
productFlavors{
app1{
resValue "string", "app_name", "app1"
resValue "bool", "isrRank", 'true'
buildConfigField "int", "TYPE", "1"
manifestPlaceholders = [ENVIRONMENT: "app1",
app_icon : "@mipmap/freechat_logo"]
}
app2{
resValue "string", "app_name", "app2"
resValue "bool", "isrRank", 'true'
buildConfigField "int", "TYPE", "2"
manifestPlaceholders = [ENVIRONMENT: "app2",
app_icon : "@mipmap/ic_launcher"]
}
}
打出不同应用名,不同应用图标,不同包名的包
flavorDimensions "app"
productFlavors {
app1 {
manifestPlaceholders = [str: "releaseStr", package_name: "com.nade.androidsqdemo1"]
applicationId "com.nade.androidsqdemo1"
resValue "string", "app_name", "app1"
resValue "bool", "isrRank", 'true'
buildConfigField "int", "TYPE", "1"
manifestPlaceholders = [ENVIRONMENT: "app1",
app_icon : "@mipmap/freechat_logo"]
}
app2 {
manifestPlaceholders = [str: "releaseStr", package_name: "com.nade.androidsqdemo2"]
applicationId "com.nade.androidsqdemo2"
resValue "string", "app_name", "app2"
resValue "bool", "isrRank", 'true'
buildConfigField "int", "TYPE", "2"
manifestPlaceholders = [ENVIRONMENT: "app2",
app_icon : "@mipmap/ic_launcher"]
}
}
打出不同应用名,不同应用图标,不同包名,不同版本,不同版本号的包
flavorDimensions "app"
productFlavors {
app1 {
manifestPlaceholders = [str: "releaseStr", package_name: "com.nade.androidsqdemo1"]
applicationId "com.nade.androidsqdemo1"
versionCode 1
versionName "1.0"
resValue "string", "app_name", "app1"
resValue "bool", "isrRank", 'true'
buildConfigField "int", "TYPE", "1"
manifestPlaceholders = [ENVIRONMENT: "app1",
app_icon : "@mipmap/freechat_logo"]
}
app2 {
manifestPlaceholders = [str: "releaseStr", package_name: "com.nade.androidsqdemo2"]
applicationId "com.nade.androidsqdemo2"
versionCode 2
versionName "2.0"
resValue "string", "app_name", "app2"
resValue "bool", "isrRank", 'true'
buildConfigField "int", "TYPE", "2"
manifestPlaceholders = [ENVIRONMENT: "app2",
app_icon : "@mipmap/ic_launcher"]
}
}
打出不同应用名,不同应用图标,不同包名,不同版本,不同版本号,不同签名的包
signingConfigs {
def key1alias = 'db'
def key1Password = '123456'
def key1FilePath = 'G:/SpaceFile/AndroidTestDemo/db.jks'
def store1PassWord = '123456'
def key1alias1 = 'db1'
def key1Password1 = '123456'
def key1FilePath1 = 'G:/SpaceFile/AndroidTestDemo/db1.jks'
def store1PassWord1 = '123456'
release1 {
keyAlias key1alias
keyPassword key1Password
storeFile file(key1FilePath)
storePassword(store1PassWord)
}
release2{
keyAlias key1alias1
keyPassword key1Password1
storeFile file(key1FilePath1)
storePassword(store1PassWord1)
}
}
flavorDimensions "app"
productFlavors {
app1 {
manifestPlaceholders = [str: "releaseStr", package_name: "com.nade.androidsqdemo1"]
applicationId "com.nade.androidsqdemo1"
versionCode 1
versionName "1.0"
resValue "string", "app_name", "app1"
resValue "bool", "isrRank", 'true'
buildConfigField "int", "TYPE", "1"
manifestPlaceholders = [ENVIRONMENT: "app1",
app_icon : "@mipmap/freechat_logo"]
signingConfig signingConfigs.release1
}
app2 {
manifestPlaceholders = [str: "releaseStr", package_name: "com.nade.androidsqdemo2"]
applicationId "com.nade.androidsqdemo2"
versionCode 2
versionName "2.0"
resValue "string", "app_name", "app2"
resValue "bool", "isrRank", 'true'
buildConfigField "int", "TYPE", "2"
manifestPlaceholders = [ENVIRONMENT: "app2",
app_icon : "@mipmap/ic_launcher"]
signingConfig signingConfigs.release2
}
}
打出不同应用名,不同应用图标,不同版本,不同版本号,不同签名的包
signingConfigs {
def key1alias = 'db'
def key1Password = '123456'
def key1FilePath = 'G:/SpaceFile/AndroidTestDemo/db.jks'
def store1PassWord = '123456'
def key1alias1 = 'db1'
def key1Password1 = '123456'
def key1FilePath1 = 'G:/SpaceFile/AndroidTestDemo/db1.jks'
def store1PassWord1 = '123456'
release1 {
keyAlias key1alias
keyPassword key1Password
storeFile file(key1FilePath)
storePassword(store1PassWord)
}
release2{
keyAlias key1alias1
keyPassword key1Password1
storeFile file(key1FilePath1)
storePassword(store1PassWord1)
}
}
flavorDimensions "app"
productFlavors {
app1 {
manifestPlaceholders = [str: "releaseStr", package_name: "com.nade.androidsqdemo1"]
applicationId "com.nade.androidsqdemo1"
versionCode 1
versionName "1.0"
resValue "string", "app_name", "app1"
resValue "bool", "isrRank", 'true'
buildConfigField "int", "TYPE", "1"
manifestPlaceholders = [ENVIRONMENT: "app1",
app_icon : "@mipmap/freechat_logo"]
signingConfig signingConfigs.release1
}
app2 {
manifestPlaceholders = [str: "releaseStr", package_name: "com.nade.androidsqdemo2"]
applicationId "com.nade.androidsqdemo1"
versionCode 2
versionName "2.0"
resValue "string", "app_name", "app2"
resValue "bool", "isrRank", 'true'
buildConfigField "int", "TYPE", "2"
manifestPlaceholders = [ENVIRONMENT: "app2",
app_icon : "@mipmap/ic_launcher"]
signingConfig signingConfigs.release2
}
}
清单文件
android:allowBackup="true"
android:icon="${app_icon}"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
可打包测试。欢迎评论/讨论私信