Skip to content
rbayer edited this page Feb 25, 2012 · 8 revisions

#How to build K-9 Mail

Introduction

K-9 Mail targets Java 1.5 (but we're using Java 1.6 @Override annotations, so a Java 1.6 compiler is needed).

K-9 Mail runs on Android 1.5 and newer versions. Currently SDK 2.2 is needed to build the code because we dynamically load classes with API 4/5/6/7/8 code if the platform supports it.

Building with ant

To build

  • Create a file called 'local.properties' at the root of the source tree with the following entry sdk.dir=/path/to/android-sdk-linux
  • ant debug

To install on your simulator or local device

adb install -r bin/K9-debug.apk

To build and sign the project for upload to the marketplace

You'll need a few new entries in your local.properties:

gcode-user=yourname
gcode-pass=your-secret-token

You'll also need googlecode_upload.pl from http://search.cpan.org/dist/Google-Code-Upload/

  1. Edit AndroidManifest.xml to increment the versionCode and versionName
  2. ant clean release
  3. Check in and tag your new version number
  4. Test on actual device hardware
  5. Upload to the market

Building with Eclipse

You'll need Eclipse with the Android Development Tools plugin installed. Follow the full directions found here: http://developer.android.com/sdk/eclipse-adt.html#installing. Make sure your Android SDK and ADT plugin are both up to date.

Building K-9 can take up to 1 GB of memory. You have to allow Eclipse to use this amount of memory or you will get out-of-memory errors when the Android compilers are run. In order to do this, edit your eclipse.ini file and make sure the following arguments are present: -vmargs -Xms128m -Xmx1024m

You can also pass these parameters to Eclipse on the command line. Now...

  1. Inside your working copy, make sure you have a directory named 'gen'
  2. From Eclipse, File > Import
  3. Under General, select 'Existing Projects into Workspace' and click Next
  4. Next to 'Select root directory', Browse to your K-9 working copy
  5. Click Finish
  6. In the Package Explorer, right click 'k9mail' and click 'Properties'
  7. Select 'Java Compiler'
  8. Check 'Enable project specific settings'
  9. Set the 'Compiler compliance level' to 1.6
  10. Click OK

You should now be able to build the project. If it had been built previously, make sure you clean it first. If you get errors about missing translation information for some locales, go to Project -> Properties -> Android Lint Settings and change the severity of MissingTranslations to Warning.

To install on your simulator or local device

Go to Run->Run Configurations, click Android Application then click the "new" icon (sheet with plus sign). Change the name to your liking, then click the brows button and select the K9 project. Click OK.

On subsequent runs, you can click Run->Run History and then click the name of your Run Configuration.

Clone this wiki locally