Replace a String resource in buildTypes

I want to replace a string in my resources in a special buildType. Is this possible?

I use android studio and I tried this:

My String Resource:

<string name="test">test</string>

My build.gradle:

buildTypes{
    flavor1{
        copy{
            from('src/res/'){
                 include '**/*.xml'
                 filter{String line -> line.replaceAll(test, "another String")}
            }
            into '$buildDir/res'
        }
    }
}

My build is successfull, but the String is not replaced.

It’s a similar question to this post: http://forums.gradle.org/gradle/topics/whats_the_best_way_to_filter_replace_tokens_in_android_resources_with_the_new_build_system

My code based on this post: http://stackoverflow.com/questions/17275461/how-to-replace-strings-resources-with-android-gradle

Sorry, but I’m new to gradle and DSL. I hope somebody can help me.

I solved the problem on my own. See this link on so: http://stackoverflow.com/questions/17465353/how-to-replace-a-string-for-a-buildvariant-with-gradle-in-android-studio/17572644#17572644