Skip to content

Instantly share code, notes, and snippets.

@igor-brishkoski
Last active January 2, 2018 23:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save igor-brishkoski/68deeab53501dd80f98fbd06cac6c008 to your computer and use it in GitHub Desktop.
Save igor-brishkoski/68deeab53501dd80f98fbd06cac6c008 to your computer and use it in GitHub Desktop.
Store them in one place
//build.gradle
android{
...
productFlavors{
staging{
//use in java code
buildConfigField "String", "SERVICE_THAT_I_NEED", "s3cr3t_k3y_f0r_hackz0rz_staging"
buildConfigField "String", "MY_BACKEND_URL", "https://www.staging-example.com/api"
//use in xml, like AndroidManifest.xml
resValue "string", "google_maps_key", "5435651423234"
}
production{
//use in java code
buildConfigField "String", "SERVICE_THAT_I_NEED", "s3cr3t_k3y_f0r_hackz0rz_production"
buildConfigField "String", "MY_BACKEND_URL", "https://www.production-example.com/api"
//use in xml, like AndroidManifest.xml
resValue "string", "google_maps_key", "5435651423234"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment