Created
June 4, 2018 10:09
-
-
Save andrew-codechimp/e7af2137ecbd5d30b4cc7220b5d1e64b to your computer and use it in GitHub Desktop.
[Gradle load Android signing.properties] #Android #Gradle
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 { | |
| debug { | |
| storeFile file("debug.keystore") | |
| storePassword "android" | |
| keyAlias "androiddebugkey" | |
| keyPassword "android" | |
| } | |
| release | |
| } | |
| buildTypes { | |
| debug { | |
| } | |
| release { | |
| signingConfig signingConfigs.release | |
| } | |
| } | |
| } | |
| if (signingPropsFile.canRead()) { | |
| def props = new Properties() | |
| props.load(signingPropsFile.newReader('UTF-8')) | |
| if (props.containsKey('STORE_FILE') && props.containsKey('STORE_PASSWORD') && | |
| props.containsKey('KEY_ALIAS') && props.containsKey('KEY_PASSWORD')) { | |
| android.signingConfigs.release.storeFile = file(props['STORE_FILE']) | |
| android.signingConfigs.release.storePassword = props['STORE_PASSWORD'] | |
| android.signingConfigs.release.keyAlias = props['KEY_ALIAS'] | |
| android.signingConfigs.release.keyPassword = props['KEY_PASSWORD'] | |
| } else { | |
| println 'signing.properties found but some entries are missing' | |
| android.buildTypes.release.signingConfig = null | |
| } | |
| } else { | |
| println 'signing.properties not found' | |
| android.buildTypes.release.signingConfig = null | |
| } |
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
| subprojects { | |
| ext.signingPropsFile = rootProject.file('signing.properties') | |
| } |
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
| STORE_FILE=\\PATH TO YOUR\\file.keystore | |
| STORE_PASSWORD=password | |
| KEY_ALIAS=alias | |
| KEY_PASSWORD=aliaspassword |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment