Android 构建变体

https://developer.android.com/studio/build/build-variants.html?hl=zh-cn

productFlavors {
tianxiang {
minSdkVersion 15
applicationId 'com.xxx.live'
proguardFile './app/proguard-rules.pro'
signingConfig signingConfigs.LiveKeystore
targetSdkVersion 25
versionCode 2017062601
versionName '2.4.3'
}
wanku {
minSdkVersion 15
applicationId 'com.xxx2.live'
proguardFile './app/proguard-rules.pro'
signingConfig signingConfigs.WanKuLiveKeystore
targetSdkVersion 25
versionCode 2017062601
versionName '2.4.3'
}
}

buildTypes {
debug {
signingConfig null
//signingConfig signingConfigs.LiveKeystore
productFlavors.tianxiang.signingConfig signingConfigs.LiveKeystore
productFlavors.wanku.signingConfig signingConfigs.WanKuLiveKeystore
buildConfigField "boolean", "LOG_DEBUG", "true"
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
release {
zipAlignEnabled true
minifyEnabled true
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
buildConfigField "boolean", "LOG_DEBUG", "true"
}
}

代码变体,main下要删除
sourceSets {
main {
jni.srcDirs = []
jniLibs.srcDir 'libs'
}
xiabo{
java.srcDirs = ['src/xiabo', 'src/xiabo/java', 'src/xiabo/java/']
}
xingfei{
java.srcDirs = ['src/xingfei', 'src/xingfei/java', 'src/xingfei/java/']
}
}
不同变体配置不同依赖:
wankuCompile project(path: ':lib-ucloudstream')

你可能感兴趣的:(Android 构建变体)