How can I check if a buildType is debuggable in my build.gradle?
I want to do something like:
if(debug) {
file.write("xxxxx")
}
in my build.gradle
Also, how can I build a debug and release buildType from AndroidStudio? I don't mean from command line by typing ./gradlew assembleRelease
or assembleDebug
, I mean from the IDE itself when you press the play button. Is this 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"
}
}
}
How can I check if a buildType is debuggable in my build.gradle?
You can do so using the buildType's debuggable 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 a debug and release buildType from AndroidStudio?
Click the "Build Variants" button in the lower left corner of Android Studio to open up the Build Variants panel. From there you can select the build variant that you want to use when you run/debug.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With