Created
August 16, 2020 18:07
-
-
Save root-ansh/63e1885b8d88663730c1644475b0a928 to your computer and use it in GitHub Desktop.
Securing keys-Medium
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// app/build.gradle | |
plugins { | |
... | |
} | |
android { | |
... | |
defaultConfig { | |
... | |
} | |
buildTypes { | |
debug{ | |
def credsFile = rootProject.file("secure\\debug_creds.properties") | |
def prop = new Properties() | |
prop.load(new FileInputStream(credsFile)) | |
buildConfigField('String', 'KEY_USER', prop['KEY_USER']) // always use single quotes here | |
} | |
release { | |
def credsFile = rootProject.file("secure\\release_creds.properties") | |
def prop = new Properties() | |
prop.load(new FileInputStream(credsFile)) | |
buildConfigField('String', 'KEY_USER', prop['KEY_USER']) // always use single quotes here | |
minifyEnabled true | |
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | |
} | |
} | |
... | |
} | |
dependencies { | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment