AndroidStudio Gradle: how to configure buildTypes and check which buildType when creating?

How to verify that buildType is being debugged in my build.gradle ?

I want to do something like:

if(debug) { file.write("xxxxx") } 

in my build.gradle

Also, how can I create debugging and buildType version from AndroidStudio? I don’t mean from the command line by typing ./gradlew assembleRelease or assembleDebug , I mean from the IDE itself when I click the play button. Is it possible?

I have buildTypes configured as such in my android block:

 buildTypes { release { signingConfig signingConfigs.storeSign defaultConfig { versionCode 1100 versionName "1.1.00" } } debug { defaultConfig { versionCode 1201 versionName "1.2.01" } } } 
+7
android android-studio gradle
source share
1 answer

How to verify that buildType is being debugged in my build.gradle?

You can do this using the debuggable buildType flag. The end result might look something like this:

 android { buildTypes.all { buildType -> println buildType.name print "Debuggable: " println buildType.debuggable } } 

Also, how can I build debugging and buildType version from AndroidStudio?

Click the Build Variants button in the lower left corner of Android Studio to open the Build Variants panel. From there, you can select the build option that you want to use when starting / debugging.

enter image description here

+12
source share

All Articles