Skip to content

Instantly share code, notes, and snippets.

@TheDancerCodes
Last active July 23, 2019 07:00
Show Gist options
  • Save TheDancerCodes/3ee23c33320052e5a9f6cf472256819e to your computer and use it in GitHub Desktop.
Save TheDancerCodes/3ee23c33320052e5a9f6cf472256819e to your computer and use it in GitHub Desktop.
A build.gradle file containing code for generating a release APK
apply plugin: 'com.android.application'
...
// Create a variable called keystorePropertiesFile, and initialize it to your
// keystore.properties file, in the rootProject folder.
def keystorePropertiesFile = rootProject.file("keystore.properties")
// Initialize a new Properties() object called keystoreProperties.
def keystoreProperties = new Properties()
// Load your keystore.properties file into the keystoreProperties object.
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
android {
...
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
// Using a signing config in a release build
signingConfig signingConfigs.release
}
}
}
dependencies {
// Your dependencies go here.
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment