Q: Copy a different config file for each Android Studio Gradle build type I'm just about to switch from ant to gradle as my Android build system. One problem that I could not figure out how to fix is the use of different config files per build type.
In the project root, there is a folder config which contains a file for the debug and one for the release build. When building the project, the appropriate file should be copied to the resources folder.
Simplified build.gradle:
android {
    buildTypes {
        debug {
            minifyEnabled false
            // copy config/config_debug.xml to res/values/config.xml
        }
        release {
            minifyEnabled true
            ...
            // copy config/config_release.xml to res/values/config.xml
        }
    }

    ...
}

I have tried different things like 
def configFile = 'XXX'
task copyConfigFileTask(type: Copy) {
    println "-> using config file $configFile"
    from 'config/$configFile'
    into 'res/values'
    rename {
        fileName -> 'config.xml'
    }
    outputs.upToDateWhen {
        false
    }
}

assembleDebug.dependsOn {
    copyConfigFileTask { configFile = 'config_release.xml' }
    copyConfigFileTask.execute()
}

but that doesn't really work. I cannot imagine that such a simple and common task is so complicated with Gradle, is it?
Any help is appreciated!

A: Step #1: Put the debug version in src/debug/res/values/config.xml.
Step #2: Put the release version in src/release/res/values/config.xml.
Step #3: Beer.
Debug builds will pull in the debug version of your file. Release builds will pull in the release version of your file. No muss, no fuss.
