我阅读了android docs的“Build System”部分:http://developer.android.com/sdk/installing/studio-build.html
因此构建变体由product_flavor-build_type组成。我有这个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'
}
}
我想创建mobile-debug-automation-unaligned.apk,这样我就可以在dagger模块中使用“FAKE_HTTP_RESPONSE”BuildConfig变量。
但是当我点击Android Studio中的“Build Variants”时,我看到一个构建变体 - “internalDebug”。我希望看到9个构建变体(buildType * productFlavor)。
查看我的项目目录,我看到以下apks:
MY_APP / mobile:mobile-release.apk,mobile-debug-unaligned.apk
MY_APP / mobile / build / outputs / apk:mobile-internal-debug-unaligned.apk
如何生成新的“自动化”apk?