Skip to content

Instantly share code, notes, and snippets.

@nguyenlinhnttu
Created February 12, 2019 02:11
Show Gist options
  • Save nguyenlinhnttu/0742fe4c68539ec6a68dcb286e2e6948 to your computer and use it in GitHub Desktop.
Save nguyenlinhnttu/0742fe4c68539ec6a68dcb286e2e6948 to your computer and use it in GitHub Desktop.
//file local.properties
tmdb_api_key = "xxxxxxxxxxxxxxxxxxxxxxxxxx"
//file 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
}
//Tại file Constants
var tmdbApiKey = BuildConfig.TMDB_API_KEY
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment