Corey Lanier
10/06/2020, 3:20 AMAfzal Najam
10/06/2020, 8:49 PMCorey Lanier
10/06/2020, 8:50 PMAfzal Najam
10/06/2020, 8:53 PMCorey Lanier
10/06/2020, 8:53 PMAfzal Najam
10/06/2020, 8:54 PMCorey Lanier
10/06/2020, 9:40 PMAfzal Najam
10/07/2020, 1:43 AMCorey Lanier
10/07/2020, 1:51 AMAfzal Najam
10/07/2020, 2:00 AMdesigner_news_client_id
is used here, defined in the gradle.properties file and then used in build.gradle
https://github.com/android/plaid/search?q=designer_news_client_id
Since the root gradle.properties
file is usually checked into version control, you can create one in the app folder as well, and it will be imported automatically too.Corey Lanier
10/07/2020, 2:24 AMgrade.properties
file for each build?Afzal Najam
10/07/2020, 4:35 AMgradle.properties
, you can have:
STAGING_DOMAIN=<http://staging.com|staging.com>
PROD_DOMAIN=<http://prod.com|prod.com>
then you can access those in your build.gradle
file to expose it to your app:
android {
//... other stuff
buildTypes {
staging {
buildConfigField 'String', 'API_DOMAIN', "\"${STAGING_DOMAIN}\""
}
release {
buildConfigField 'String', 'API_DOMAIN', "\"${PROD_DOMAIN}\""
}
}
Then you can access BuildConfig.API_DOMAIN
everywhere in your app code. When you select the release variant, it will be the value of PROD_DOMAIN
, when you select staging variant, it'll be the value of STAGING_DOMAIN
hope that helpsCorey Lanier
10/07/2020, 4:45 AMgradle.properties
or local.properties
? local.properties
is defaulted into gitignore, but gradle.properties
isn’t. If it’s gradle.properties
then how would i ignore this?Corey Lanier
10/07/2020, 4:48 AMapp/gradle.properties
and put that on ignore instead?Afzal Najam
10/07/2020, 9:27 PM