-
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).
K-9 Mail runs on Android 2.1 and newer versions. Currently SDK 4.0.3 (API 15) is needed to build the code.
- 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
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'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...
- Inside your working copy, make sure you have a directory named 'gen'
- From Eclipse, File > Import
- Under General, select 'Existing Projects into Workspace' and click Next
- Next to 'Select root directory', Browse to your K-9 working copy
- Click Finish
- In the Package Explorer, right click 'k9mail' and click 'Properties'
- Select 'Java Compiler'
- Check 'Enable project specific settings'
- Set the 'Compiler compliance level' to 1.6
- 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.
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.
These instructions are for IDEA 11, but K-9 has successfully compiled under IDEA 9 and 10 in the past.
- Checkout the sources from GitHub.
- Create a New Project and select "Create project from existing sources."
- Specify the path to your k-9 checkout. You should be able to Next your way through all of the defaults.
- Let IntellIJ create a run configuration for your project. By default, this will run in the simulator.
- Select your "K-9" project in the project pane, alt/right-click on it and Open Module Settings (F4 on Windows).
- Select Project under Project Settings and set the Project language level to 6.0.
- We need to remove IntelliJ's auto-detected JUnit dependency, since it conflicts with the one already built into the Android SDK. 0. Select Modules under Project Settings and select the Tests module. 0. In the center pane, select the Tests module. 0. In the right pane, navigate to the Dependencies tab. 0. Double-click on the compile-only-libs library. 0. Select the auto-detected JUnit jar and click on Detach
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 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 2.3.1 or higher as your platform. This is android-9, 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; IntelliJ can't autodetect that this is an Android project.
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 and Edit Configurations. Change the Target Device to either USB Device to always run on your device or Chooser Dialog to select on each launch.