Replace a String resource in buildTypes

(Olesja Weidmann) #1

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:

                 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:

My code based on this post:

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

(Olesja Weidmann) #2

I solved the problem on my own. See this link on so: