From e032b1b8728284931d791babe2ff950c95c0eed6 Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Wed, 19 Aug 2020 17:37:34 +0100 Subject: [PATCH] don't load properties globally --- app/build.gradle | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 7a0542a4..a914f406 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,12 +1,5 @@ import com.google.gms.googleservices.GoogleServicesPlugin -Properties twitterProps = new Properties() -try { - twitterProps.load(project.file('twitter.properties').newDataInputStream()) -} catch (Exception ex) { - throw new GradleException("Missing twitter.properties.") -} - apply plugin: 'com.android.application' android { @@ -50,10 +43,14 @@ android { buildTypes { debug { + Properties twitterProps = new Properties() + twitterProps.load(project.file('twitter.properties').newDataInputStream()) resValue "string", "TWITTER_CONSUMER_KEY", "\"${twitterProps.getProperty("twitterConsumerKey")}\"" resValue "string", "TWITTER_CONSUMER_SECRET", "\"${twitterProps.getProperty("twitterConsumerSecret")}\"" } release { + Properties twitterProps = new Properties() + twitterProps.load(project.file('twitter.properties').newDataInputStream()) resValue "string", "TWITTER_CONSUMER_KEY", "\"${twitterProps.getProperty("twitterConsumerKey")}\"" resValue "string", "TWITTER_CONSUMER_SECRET", "\"${twitterProps.getProperty("twitterConsumerSecret")}\"" minifyEnabled false