Please note that these Trac pages are no longer being updated. Wiki contents/documentation have moved to GitHub.

Building Seattle On Android

This document describes how do build the APK file for Seattle on Android. This package contains the UI for Seattle that is used by the Android users. However, the non-installer Seattle code (i.e. everything in the Linux installer) is downloaded at install time. This is done to make crediting users for donations work smoothly.


Getting the SDK


To build the APK file, you must first download the Android SDK. It is recommended you install every version of Android > 2.1 (API > 7) because Seattle runs on all of these platforms.

To do the installation, download and unzip the file. On some platforms, you then need to run tools/android to do the actual installation and download.


Getting Seattle On Android Ready To Build


The APK source for Seattle On Android is located in SVN under trunk/dist/android/SeattleOnAndroid. You will need to create a local.properties file in this directory which refers to your SDK install location. The contents of this file will look something like this, be sure to replace the sdk.dir with the appropriate one for your system:

target=android-7
sdk.dir=/Users/justincappos/android-sdk-macosx/ 

Do not use '~' characters as ant does not seem to support them well

Now you need to update the project so that it is ready to build. From the SeattleOnAndroid directory, do:

android update project --name SeattleOnAndroid --target android-7 --path . 

The target should match that in the file above.

Note that if android isn't in your path you will need to specify the full path for it.


Building the APK


At this point, you should be able to build the APK by running ant debug from the trunk/dist/android/SeattleOnAndroid directory. This will create a release that is signed with the debug key.

You can also do ant release to create a version of the APK that is ready for release, but is unsigned.


Testing the APK


You should build and test the APK on both virtual and real Android devices. To create virtual devices, follow the instructions at:  http://developer.android.com/tools/devices/index.html Once you've created a device, you should start it.

Then to install the APK, open a terminal and go to the sdk/platform-tools/ directory. From there, run ./adb devices and you should see your device listed as running. To install the test APK you built, run ./adb install path/to/your/apk.

Then on the emulated phone, enter the applications menu and you'll see a SeattleOnAndroid icon. Click on this to start the installation process. Note: this will require you to also download and install Python.


Fixing Problems with the APK

If the install goes smoothly, you can use the menu option on the Seattle installer and then view the log files there. This is the easiest way to see the log information from the node manager, software updater, and install scripts.

If the APK does not work, Akos recommends using logcat. A short tutorial to logcat can be found at:  http://developer.android.com/tools/help/logcat.html


Signing and Distributing the APK

Each release pushed to the Android Play store must have an increasing versionCode number. Edit AndroidManifest.xml and edit this value and the versionName string as well.

Next, build the APK with ant release . Then you need to sign the release. You will need to use the existing key / key store for the seattle project. To sign using this, do:

{{{ $ jarsigner -verbose -sigalg MD5withRSA -digestalg SHA1 -keystore my-release-key.keystore ~/seattle/trunk/dist/android/SeattleOnAndroid/bin/SeattleOnAndroid-release-unsigned.apk soakey }}}

Note that the location to the unsigned APK file may be different on your system.

You can now verify the file is signed using jarsigner -verify SeattleOnAndroid-release-unsigned.apk . It should say jar verified.

The final step is to align the jar file. To do this, use the zipalign program in the tools directory. The command will look like this:

zipalign -v 4 SeattleOnAndroid-release-unsigned.apk SeattleOnAndroid-release-aligned.apk

You are now ready to upload the APK. If you have questions or problems, see the following docs for more information:

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

 http://developer.android.com/tools/publishing/preparing.html

 http://developer.android.com/distribute/googleplay/publish/preparing.html