Sil*_*spo 9 android gradle android-min-sdk
如何仅在调试模式下使用特定的minSdkVersion?我想将minSdkVersion 21用于调试模式,但minSdkVersion 15用于发布.我不想为此使用口味,因为会给你带来麻烦.
我认为可能是这样(但不起作用):
defaultConfig {
applicationId "blacktoad.com.flapprototipo"
minSdkVersion 15
debug{
minSdkVersion 21
}
targetSdkVersion 23
versionCode 42
versionName "1.72"
multiDexEnabled true
}
Run Code Online (Sandbox Code Playgroud)
Rom*_*ych 10
有一种更好的方法可以在没有Product Flavors或挂钩到构建流程的情况下做到这一点。例子:
buildTypes {
debug {
defaultConfig.minSdkVersion 19
defaultConfig.vectorDrawables.useSupportLibrary = true
defaultConfig.multiDexEnabled = true
...
Run Code Online (Sandbox Code Playgroud)
我不想为此使用香料,因为会带来麻烦。
我认为如果没有productFlavors. 我将这个答案留给其他没有使用问题的人productFlavors。
https://developer.android.com/studio/build/multidex.html#dev-build
基本上你需要做的就是productFlavors用不同的声明minSdkVersion:
productFlavors {
dev {
// Enable pre-dexing to produce an APK that can be tested on
// Android 5.0+ without the time-consuming DEX build processes.
minSdkVersion 21
}
prod {
// The actual minSdkVersion for the production version.
minSdkVersion 14
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1469 次 |
| 最近记录: |