Building Signed APKs

Building signed APK's for Android is easy if you know what you are doing.

Preparation

First you need to have a keystore. Use this command:

#!/bin/bash
keystore_file="my_key_store.keystore"
key_name="john_doe"
secret='fake_password'
name='John Doe'
dept='Engineering'
org='TLabs Inc'
place='New York'
province='NY'
country='US'

keytool -genkey -v -keystore "$keystore_file" -alias "key_name" -keyalg "RSA" -validity 10000 -storepass "$secret" -keypass "$secret" <<EOF
$name
$dept
$org
$place
$province
$country
yes
EOF

Remember the keystore file and passwords.

Build instructions

In your build.gradle you need the following:


android {
  signingConfigs {
    release {
      storeFile file("my_keystore.keystore")
      storePassword "{password}"
      keyAlias "Key_Alias"
      keyPassword "{password}"
    }
  }
  buildTypes {
    release {
      signingConfig signingConfigs.release
    }
  }
}

About alex

Owner of this website...
This entry was posted in Android, Z1 and tagged , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *