You say you declare two specific tasks (one for each buildtype?) To declare a task for each buildtype dynamically and use its debuggable flag, you can do something like this:
android.buildTypes.all{ theBuildType ->
task ("${theBuildType.name}MyCustomTask")<<{
//use debuggable flag
println theBuildType.debuggable
}
}
is this the snippet you’re looking for?
cheers, René