Skip to content

Commit

Permalink
Gradle: Add release APK signature
Browse files Browse the repository at this point in the history
  • Loading branch information
Danang Galuh Tegar Prasetyo committed Jul 27, 2020
1 parent 71286dc commit de2df2f
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
def getPassword(String currentUser, String keyChain) {
def stdout = new ByteArrayOutputStream()
def stderr = new ByteArrayOutputStream()
exec {
commandLine 'security', '-q', 'find-generic-password', '-a', currentUser, '-s', keyChain, '-w'
standardOutput = stdout
errorOutput = stderr
ignoreExitValue true
}
//noinspection GroovyAssignabilityCheck
stdout.toString().trim()
}

buildscript {
repositories {
maven { url 'https://plugins.gradle.org/m2/' } // Gradle Plugin Portal
Expand Down Expand Up @@ -129,6 +142,7 @@ def jscFlavor = 'org.webkit:android-jsc:+'
* and the benefits of using Hermes will therefore be sharply reduced.
*/
def enableHermes = project.ext.react.get("enableHermes", false);
def pass = getPassword("danang","android_keystore")

android {
compileSdkVersion rootProject.ext.compileSdkVersion
Expand Down Expand Up @@ -160,6 +174,14 @@ android {
keyAlias 'androiddebugkey'
keyPassword 'android'
}
release {
if (project.hasProperty('MYAPP_UPLOAD_STORE_FILE')) {
storeFile file(MYAPP_UPLOAD_STORE_FILE)
storePassword pass // Change this
keyAlias MYAPP_UPLOAD_KEY_ALIAS
keyPassword pass // Change this
}
}
}
buildTypes {
debug {
Expand All @@ -168,7 +190,7 @@ android {
release {
// Caution! In production, you need to generate your own keystore file.
// see https://facebook.github.io/react-native/docs/signed-apk-android.
signingConfig signingConfigs.debug
signingConfig signingConfigs.release
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
Expand Down

0 comments on commit de2df2f

Please sign in to comment.