← Back to list

Different Android string values for debug and production

You may need to have a different string value for development and another for the release version of your Android App, maybe a URL or a…

Diego Y Kurisaki · 2016-01-18 16:57 · 124 claps · 0.6 min read
#android #android-app-development #app-id
Open on Medium ↗
Wiki topics: ML · Machine Learning

Different Android string values for debug and production

You may need to have a different string value for development and another for the release version of your Android App, maybe a URL or a third party API configuration string.

I've tried different approaches to fix this issue but finally I found one that pleased me, at least for now.

You have to add to your app/build.gradle file and add the following.

android {
    (...)
    buildTypes {
        release {
           resValue 'string', 'changedValue', '"realease version"'
        }
        debug {
           resValue 'string', 'changedValue', '"debug version"'
        }
    }
}

When you build your app, Gradle will auto generate something like the bellow in your strings.xml file

<string name=”changedValue”>Your Given Value</string>

Just use it as you use any String that's in your string strings.xml

I found it very helpful using this technique to change my Facebook App Id for my different environments.


메타데이터
post_id
2c2a0fd912e9
slug
different-android-string-values-for-debug-and-production-2c2a0fd912e9
url
https://medium.com/@diegoy_kuri/different-android-string-values-for-debug-and-production-2c2a0fd912e9
canonical_url
https://medium.com/@diegoy_kuri/different-android-string-values-for-debug-and-production-2c2a0fd912e9
author_url
https://medium.com/@diegoy_kuri
status
ok
fetched_at
2026-07-30 19:27:29