0

I am developing an android app. I need to use two google console projects for my dev environment and production. But there's a strings.xml file and I can not change their strings according to the environment. Can anyone help me?

1 Answers1

0

If you are asking to change String values depending on debug or release apk. Then you should put values in Gradle (build.gradle Module) rather than in String.xml values like this.

buildTypes {
        release {
            resValue("string", "id", "your production value here")
        }
        debug {
            resValue("string", "id", "your development value here")
        }
}

and you can get this value in code like this.

context.getString(R.string.id);

This will show after you rebuild the project after adding the values in Gradle as these are generated compileTime.

I hope this helps and please mind my English as it's not my native language.