Building Seabiscuit from the command line

This page takes you through the process of building our android app from the command line using the ant tool. The short and sweet version is simply configure where your key is saved in the local.properties file, and then run the following command: ant release

Here's all the rest of the nitty gritty details:

Prerequisites
All of the following command line programs should have been installed with the android sdk or as prerequisites, but here we want to verify that they are accessible from your command line environment. Please try running each of the following commands and ensure that no error messages are printed:

android --help ant -help keytool -help jarsigner -help

Generating the release key
If you already have a release key, good. You can skip to the next section and simply enter its location into the configuration file.

Otherwise... TODO -- write a simplified version of Obtain a suitable private key

Configuring properties to use your key
cd into your CPAndroid directory and run the following command: android update project --path. This will create a local.properties file for you which you will need to edit to configure where the release signing key is found. You'll need to fill in new entries in this file for key.store and key.alias. For example mine looks like this: # sdk.dir=/home/brad/local/android-sdk-linux key.store=/home/brad/.android/coffeeandpower.keystore key.alias=androiddebugkey
 * 1) This file is automatically generated by Android Tools.
 * 2) Do not modify this file -- YOUR CHANGES WILL BE ERASED!
 * 1) This file must *NOT* be checked into Version Control Systems,
 * 2) as it contains information specific to your local configuration.
 * 1) location of the SDK. This is only used by Ant
 * 2) For customization when using a Version Control System, please read the
 * 3) header note.

I don't know why it contains comments telling you not to modify this file. According to the android documentation, those comments are incorrect.

Building
tldr: run these 2 commands ant clean ant release

It will then build the app from scratch and when it's at the end (maybe a minute or two later) it will ask you for the keystore password, and then the alias password. It'll look like this: -release-prompt-for-password: [input] Please enter keystore password (store:/home/brad/.android/coffeeandpower.keystore): android [input] Please enter password for alias 'androiddebugkey': android In this example I'm using a copy of the debug.keystore generated when I first set up the android sdk, so the password for both is simply android.

This will have created an apk package at the location bin/CPAndroid-release.apk (along with an unsigned version as well, but we'll ignore that).

Note: If you haven't configured your local.properties file correctly to point to your keystore, then it will not prompt you for a password and it will only build a CPAndroid-release-unsigned.apk package.

Details
ant can build any of a number of different 'targets', which is what 'release' is in the ant release command. You can see all of the availible targets with the following command: ant -projectHelp

External Documentation

 * http://developer.android.com/tools/building/building-cmdline.html
 * http://developer.android.com/tools/publishing/app-signing.html