Skip to content

Instantly share code, notes, and snippets.

@navi25
Last active November 8, 2019 05:52
Show Gist options
  • Save navi25/b3b969c3fc9b532f3de9412c7ace6f28 to your computer and use it in GitHub Desktop.
Save navi25/b3b969c3fc9b532f3de9412c7ace6f28 to your computer and use it in GitHub Desktop.
//In local.properties
tmdb_api_key = "xxxxxxxxxxxxxxxxxxxxxxxxxx"
//In build.gradle (Module: app)
buildTypes.each {
Properties properties = new Properties()
properties.load(project.rootProject.file("local.properties").newDataInputStream())
def tmdbApiKey = properties.getProperty("tmdb_api_key", "")
it.buildConfigField 'String', "TMDB_API_KEY", tmdbApiKey
it.resValue 'string', "api_key", tmdbApiKey
}
//In your Constants File
var tmdbApiKey = BuildConfig.TMDB_API_KEY
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment