仅在调试模式下使用特定的minSdkVersion [英] Use a specific minSdkVersion only in a Debug mode

查看:119
本文介绍了仅在调试模式下使用特定的minSdkVersion的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何仅在调试模式下使用特定的minSdkVersion? 我想将minSdkVersion 21用于调试模式,将minSdkVersion 15用于发行版.我不想为此使用调味料,因为会带来麻烦.

How can I use a specific minSdkVersion only in a debug mode? I want to use the minSdkVersion 21 for debug mode, but minSdkVersion 15 for the release. I don't wanna use flavors for this because will give troubles.

我认为可能是这样的(但不起作用):

I think the could be like this (but don't work):

defaultConfig {
        applicationId "blacktoad.com.flapprototipo"
        minSdkVersion 15

        debug{
            minSdkVersion 21
        }

        targetSdkVersion 23
        versionCode 42
        versionName "1.72"

        multiDexEnabled true
    }

推荐答案

存在一种更好的方法来实现,而无需 Product Flavors 或加入构建流程. 示例:

There exist a better way to do it without Product Flavors or hooking into the build flow. Example:

  buildTypes {
     debug {
       defaultConfig.minSdkVersion 19
       defaultConfig.vectorDrawables.useSupportLibrary = true
       defaultConfig.multiDexEnabled = true
     ...

这篇关于仅在调试模式下使用特定的minSdkVersion的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆