I read the "Build System" section of the android docs: http://developer.android.com/sdk/installing/studio-build.html
So a build variant is composed of a product_flavor-build_type. I have this build.gradle:
buildTypes {
debug {
applicationIdSuffix '.debug'
debuggable true
minifyEnabled !skipProguard
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
signingConfig signingConfigs.debug
zipAlignEnabled false
}
debugtest {
// unit tests
applicationIdSuffix '.test'
debuggable true
minifyEnabled false
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
signingConfig signingConfigs.debug
zipAlignEnabled false
}
release {
minifyEnabled true
shrinkResources true
debuggable false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
signingConfig signingConfigs.release
}
}
productFlavors {
internal {
applicationId "${project.applicationId}.internal"
buildConfigField 'boolean', 'EXPERIMENTAL', 'true'
buildConfigField 'boolean', 'FAKE_HTTP_RESPONSE', 'false'
}
production {
applicationId project.applicationId
buildConfigField 'boolean', 'EXPERIMENTAL', 'false'
buildConfigField 'boolean', 'FAKE_HTTP_RESPONSE', 'false'
}
automation {
applicationId "${project.applicationId}.automation"
buildConfigField 'boolean', 'EXPERIMENTAL', 'true'
buildConfigField 'boolean', 'FAKE_HTTP_RESPONSE', 'true'
}
}
I'd like to create mobile-debug-automation-unaligned.apk so that I can use the "FAKE_HTTP_RESPONSE" BuildConfig variable in a dagger module.
But when I click on "Build Variants" in Android Studio I see one build variant-"internalDebug". I expected to see 9 build variants(buildType * productFlavor).
Looking in my project directories, I see the following apks:
MY_APP/mobile: mobile-release.apk, mobile-debug-unaligned.apk
MY_APP/mobile/build/outputs/apk: mobile-internal-debug-unaligned.apk
How do I generate my new "automation" apk?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.