Last active
December 22, 2015 04:28
-
-
Save grzegorz-zur/6416924 to your computer and use it in GitHub Desktop.
signing release APK - complete Gradle build script
This file contains 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
buildscript { | |
repositories { | |
mavenCentral() | |
} | |
dependencies { | |
classpath 'com.android.tools.build:gradle:0.9.+' | |
} | |
} | |
task wrapper(type: Wrapper) { | |
gradleVersion = '1.11' | |
} | |
tasks.whenTaskAdded { task -> | |
if (task.name == 'validateReleaseSigning') | |
task.dependsOn keystoreInfo | |
} | |
apply plugin: 'android' | |
repositories { | |
mavenCentral() | |
} | |
android { | |
compileSdkVersion 19 | |
buildToolsVersion '19.0.3' | |
defaultConfig { | |
minSdkVersion 10 | |
targetSdkVersion 19 | |
} | |
signingConfigs { | |
release { | |
release { | |
storeFile file('release.keystore') | |
storePassword '' | |
keyAlias '' | |
keyPassword '' | |
} | |
} | |
buildTypes { | |
release { | |
debuggable false | |
jniDebugBuild false | |
signingConfig signingConfigs.release | |
} | |
} | |
} | |
} | |
task keystoreInfo << { | |
def console = System.console() | |
if (console == null) | |
throw new IllegalStateException('no console available, use --no-daemon flag') | |
def storeFile = console.readLine('Keystore file: ') | |
def storePassword = console.readPassword('Keystore password: ') | |
def keyAlias = console.readLine('Key alias: ') | |
def keyPassword = console.readPassword('Key password: ') | |
android.signingConfigs.release.storeFile = file(storeFile) | |
android.signingConfigs.release.storePassword = new String(storePassword) | |
android.signingConfigs.release.keyAlias = keyAlias | |
android.signingConfigs.release.keyPassword = new String(keyPassword) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment