Recently I stumbled upon a problem of creating a signed Android app via command line, after spending some time on this, I have decided to post following tutorial.
This problem exist in 2 situations. For example when you want to share your application publicly, but do not want to share any details about your signing key or you would like to automate building process using some kind of CI server.
- Create a new key store using Android studio (or use existing one), this document shows how to create a new keystore:http://developer.android.com/tools/publishing/app-signing.html#studio
- After your key is created you need to setup gradle properties like this. I have edited following file:
- This file is later used in
build.gradle file like this:
apply plugin: 'com.android.application'
Please note the
signingConfigs option, these are read by gradle from the previously created file.
- To build singed application just run:
From the root folder of your repository.
- This will create signed apk file in
app/build/outputs/apk. File will be called
Few days ago I have presented following deck at local JUG meetup: Wrocław Java Users Group.
There is also a YouTube recording (in Polish):