Skip to content

Instantly share code, notes, and snippets.

@ramonrabello
Last active March 16, 2023 17:11
Show Gist options
  • Save ramonrabello/b88bd8619407e3a42d02fb7cfb32b6a9 to your computer and use it in GitHub Desktop.
Save ramonrabello/b88bd8619407e3a42d02fb7cfb32b6a9 to your computer and use it in GitHub Desktop.
Example of how to use build fields for different build types.
android {
// defaultConfig goes here
buildTypes {
debug {
buildConfigField "String", 'BASE_URL', "https://dev-api.yourbackend.com"
}
staging {
buildConfigField "String", 'BASE_URL', "https://stg-api.yourbackend.com"
}
release {
buildConfigField "String", 'BASE_URL', "https://api.yourbackend.com"
}
}
}
@lalitsharma1607
Copy link

It is worth mentioning here that after these changes if your BuildConfig.java does not get updated then you should clean project and rebuild the project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment