Last active
July 24, 2018 13:47
-
-
Save favasconcelos/ade0c2c26b6344ec383c26cea05fd2a3 to your computer and use it in GitHub Desktop.
Signing Android APK without changing the build.gradle (Same key is used for release and debug). The keystore.json is in the root directory of the project.
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
android { | |
signingConfigs { | |
key { | |
// Load keystore credentials from a config file | |
def credsFilePath = file("../keystore.json").toString() | |
def credsFile = new File(credsFilePath, "").getText('UTF-8') | |
def json = new groovy.json.JsonSlurper().parseText(credsFile) | |
// Save the config into the variables | |
storeFile file(json.android.storeFile) | |
storePassword json.android.storePassword | |
keyAlias json.android.keyAlias | |
keyPassword json.android.keyPassword | |
} | |
} | |
buildTypes { | |
release { | |
// ... | |
signingConfig signingConfigs.key | |
} | |
debug { | |
// ... | |
signingConfig signingConfigs.key | |
} | |
} | |
// ... | |
} |
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
{ | |
"android": { | |
"storeFile": "paht/to/file/keystore.jks", | |
"storePassword": "storePassword", | |
"keyAlias": "keyAlias", | |
"keyPassword": "keyPassword" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment