-
Notifications
You must be signed in to change notification settings - Fork 0
BuildingK9
#How to build K-9 Mail
K-9 Mail targets Java 1.5 (but we're using Java 1.6 @Override
annotations, so a Java 1.6 compiler is needed).
The current development version of K-9 Mail runs on Android 2.2 (Froyo) and newer versions. Currently, SDK 4.2.2 (API 17) is needed to build the code.
This document covers several alternatives for building K-9 Mail:
android update project --path . --subprojects --target android-17
android update lib-project -p plugins/Android-PullToRefresh/library/ --target android-17
ant debug
adb install -r bin/K9-debug.apk
You'll need a few new entries in your local.properties to upload to google code:
gcode-user=your-username
gcode-pass=your-secret-token
gcode-project=your project name on google code (defaults to k9mail)
You'll also need googlecode_upload.pl in your path from http://search.cpan.org/dist/Google-Code-Upload/
-
ant bump-version
orant -Dversion-name=4.200 bump-version
: this will tag and push to origin ant clean release
- Test on actual device hardware
-
ant upload
: this puts it on google code. - Upload to the market
You will need Eclipse with the Android Development Tools plugin installed. If you have not set this up already, then here is a good place that will get you started. Make sure your Android SDK and ADT plugin are both up to date. The following instructions were based on Eclipse Juno (4.2) and ADT Version 22.
You will also need to download the K-9 Mail source repository using Git.
As part of the setup, you will be creating 6 different K-9 Mail related projects inside Eclipse. Because it will be easier to adjust preferences for these projects if they are kept separate from any other projects, you should create a new workspace for use with K-9 Mail.
Start Eclipse. A dialog will likely pop up asking that you select a workspace. If that doesn't happen, then once Eclipse has started, use File -> Switch Workspace -> Other... to bring up the selection dialog. In the dialog, use the Browse button to navigate and make a new folder (somewhere outside of your K-9 Mail source tree) where the new workspace will reside. If Eclipse opens a Welcome window, simply close it to see the workspace windows behind it.
There are likely numerous tweaks to the workspace preferences that would be beneficial (for example, adjustments affecting code style), but for the moment, there are just a couple that should be reviewed:
-
Text file encoding
In the Eclipse menu, go to Window -> Preferences. In the dialog, expand the General category and select Workspace. Change the Text file encoding setting to UTF-8. Click Apply to save (the dialog remains open).
-
Compiler compliance level
In that same dialog, expand the Java category and select Compiler. Set the Compiler compliance level to 1.6. Click OK to save the settings and close the dialog.
In the Eclipse menu, go to File -> Import.... In the dialog, expand the Android category and select Existing Android Code Into Workspace. Click Next.
Use the Browse button to navigate to the top folder of the K-9 Mail source tree on your system and click OK. A set of 6 projects should automatically be found and selected for import into the workspace:
- k9mail
- k9mail-ActionBarSherlock
- k9mail-Android-PullToRefresh
- k9mail-ckChangeLog
- k9mail-HoloColorPicker
- k9mail-tests
Click Finish. Eclipse will import the projects and immediately begin building them. You can go to Window -> Show View -> Progress to monitor its progress. Once everything is built, you can click on the Problems tab. You should see no errors and maybe 200+ warnings. This is typical.
If you have an official version of K-9 Mail already installed from either the Play Store or from the Downloads page, you must first uninstall it before you will be able to install your own version. You might want to export and save your settings before uninstalling.
To install and run the app, click on the k9mail project folder in the Project Explorer window, and then follow these general instructions.
You can also install and run the test package. Click on the k9mail-tests project folder in the Project Explorer window, and then follow these general instructions.
These instructions are for IDEA 12, but K-9 has successfully compiled under IDEA 9, 10, and 11 in the past.
- Checkout K9's source from GitHub.
- Open k9mail.ipr in IntelliJ.
- You'll get a green dialog in the top right corner asking you to import the Maven POM for ActionBarSherlock and Android-PullToRefresh -- select auto-import.
If you've never done Android development in IntelliJ before, you'll need to add your Android SDK to IntelliJ.
- Go to SDKs under Platform Settings
- Click the + on top to add a new platform and select Android SDK.
- Specify the path to your SDK root. You don't need to navigate to the specific platform you want; just the root is fine.
- Select your preferred 1.6 or 1.7 JDK. If you're on 64bit Windows, it's still recommended you select a 32bit SDK, since some of the Android toolchain is still 32 bit.
- Select Android 4.1.2 or higher as your platform. This is android-16, the minimum platform we require.
To configure K-9 to use your new SDK, select Project under Project Settings, and choose your Android SDK under Project SDK. You'll need to do this even if you already have an Android SDK configured in IntelliJ since different projects can use different SDKs..
To execute the first build of your project, click on the build icon in the top menu (it looks like a 4-box square with an arrow in the top-left corner to the left of the K-9 dropdown). If it's successful, the Messages pane should pop up with only Information and Warning messages.
Click on the Play button to the right of the K-9 entry in the drop-down box. The default is to launch in an emulator. To launch on your device, click on the K-9 drop down, then Edit Configurations. Change the Target Device to either USB Device to always run on your device or Chooser Dialog to select on each launch.