Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use a specific minSdkVersion only in a Debug mode

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
    }
like image 598
Siloé Bezerra Bispo Avatar asked Sep 20 '16 12:09

Siloé Bezerra Bispo


People also ask

How do I know if an app is in debug mode?

You cant test if application package is signed with debug key. Debug key is automatically generated by Android SDK tools while you are developing application. One way is to obtain your debug key signature, hardcode it into your code, and then test if your application is signed with this key.

What is BuildConfig debug?

In recent versions of the Android Developer Tools (ADT) for Eclipse, there's a class called BuildConfig which is automatically generated by the build. This class is updated automatically by Android's build system (like the R class), and it contains a static final boolean called DEBUG, which is normally set to true.


1 Answers

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
     ...
like image 91
Roman Nazarevych Avatar answered Oct 11 '22 22:10

Roman Nazarevych