Code This

std::cout <<me.ramble() <<std::endl;

Building K-9 Mail With Exchange ActiveSync Support

with 34 comments

I have blogged in the past about the less than fortunate state of Exchange support in K-9. This is due to the fact that K-9 communicates with Exchange through and outdated and problematic protocol: WebDAV. WebDAV support is turned off by default in Exchange 2007, and completely removed in Exchange 2010. This of course implies that K-9 does not support Exchange 2010. Since I started working on K-9, I have had the desire to replace the use of WebDAV with the Exchange ActiveSync protocol, which is designed specifically for mobile devices. Unfortunately, this task was much too large for me to take on in my (non-existent) free time. Lucky for us Google sponsors the annual Summer of Code.

This year K-9 was granted 4 Summer of Code projects, including EAS support. The project was successful, and at this point we have “mostly working” EAS support in a branch of the K-9 repository on github. There are still a few small issues to work out, and a few small features to complete, but I currently use K-9 with EAS support for email on my phone. If you would like to build K-9 with EAS support for your own personal use, I am including step-by-step instructions for doing so (though as usual, I do assume some basic knowledge of source control and building java applications).

In order get the K-9 sources and complete a build, you will need a git client, a JDK, ant (you can also use eclipse, but I don’t include instructions for that), and the Android SDK (make sure it’s up to date). The first step is fetching the source:

git clone k9mail

This will clone the repository at into the directory k9mail. This fetches all branches in the K-9 repo, including the ms-eas branch where EAS support lives. The next step is to “checkout” the ms-eas branch:

git checkout -b ms-eas origin/ms-eas

This tells git to create a local branch named “ms-eas” that tracks the remote branch at origin/ms-eas, and switch to this new branch. Now you must build the K-9 source. First, create a file called ‘’ at the root of the source tree with the following entry:


Obviously, replace “/path/to/android-sdk” with the path to the Android SDK on your machine. The command to build is:

ant debug

This will build a signed and zipaligned installer ready for installation on your device. Finally, plug your phone into your PC via USB and ensure it is recognized by adb. To install the freshly built K-9:

adb install -r bin/K9-debug.apk

If you have K-9 installed from the market, you must uninstall it first. Your new K-9 will be signed with a different key than the market version and Android will not let you install this new version if the keys don’t match. Alternatively, you can give the app a new name in AndroidManifest.xml, but that’s outside the scope of this blog post.

If you want to report issues, feel free to mail k-9-dev [at]


Written by Kris Wong

September 29, 2011 at 3:29 pm

34 Responses

Subscribe to comments with RSS.

  1. Any rough estimate (a few months? longer?) on when this might be ready for the masses? I’ve been hoping for an update on the summer of code project for a few months, but really am waiting for it to be integrated into the main k-9 tree.


    October 24, 2011 at 2:46 am

  2. Our SoC student working on this project expressed the desire to continue to work on it after SoC ended. However, he has not done any work since. This leaves me to slowly hack on it here and there. I have a laundry list of issues to fix before this will be ready for prime time.

    Kris Wong

    October 24, 2011 at 11:38 am

  3. For people needing a more immediate solution, I think DavMail can bridge the gap. It’s essentially an imapexchange proxy.


    October 25, 2011 at 9:03 am

    • Interesting suggestion. Exchange server itself also supports IMAP/POP/SMTP, if enabled by the administrator.

      Kris Wong

      October 25, 2011 at 9:46 am

  4. Are you interested in any kind of feedback/testing?

    I compiled and installed ms-eas branch and although it works with Hotmail EAS, all email come with the date is synced rather than the actual on the server, which ruins any real chronological order.

    Let me know if you need logs/debug information. I’m not a programmer but a many years experienced Linux user. With very little instructions I can provide what you would need.


    November 26, 2011 at 8:40 am

    • Beta testing is always good, but this feature isn’t quite ready for beta yet. I’m still working on much larger changes. Hopefully it won’t be too long before I can start worrying about the details!

      That being said, I don’t recall having seen this particular issue.

      Kris Wong

      November 30, 2011 at 11:13 am

  5. While waiting on k9 I sunk $10 into “Enhanced Email”. ActiveSync is must have for me — that and true IMAP4rev1.

    I use Hotmail and yahoo. I do not use Gmail. Incidentally Gmail employs ActiveSync. (Go on, try it)

    Issue 750 has a claimant of activesync (EAS) capable build of k9

    More power to the k9 team for the fork :) I plan to motivate some people to donate in the name of activesync ;}

    bob android marley

    November 30, 2011 at 6:32 am

    • I know gmail was used extensively for the initial development of this “feature” (which was done by a GSoC student).

      I had briefly looked at EE in the past, I couldn’t see any difference from the stock email application (not that I really looked very hard).

      Kris Wong

      November 30, 2011 at 11:22 am

  6. Hi Kris,

    I see on Android Market that K-9 was just updated, February 15, 2012. I know you have serious time constraints, and the K-9 app as it is is fantastic! As others have mentioned, though, the only (for me, really, absolutely only) missing feature is any sort of Exchange 2010 support.

    Do you have any general estimate of when you think the ActiveSync support pre-alpha version of K9 will move past that stage?

    Thanks a ton and keep up the great work with this program!

    John Markus

    February 22, 2012 at 10:56 am

    • @John: Unfortunately I do not. I have actually put K-9 on the back burner for a short while as I am currently writing another application to be released to the market soon. I will hopefully return to K-9 within the next couple weeks.

      Kris Wong

      February 24, 2012 at 3:29 pm

  7. I am looking forward for active sync support in K9.. that would be the holy grail of email apps


    February 25, 2012 at 11:47 am

  8. Microsoft filed patents on all kinds of protocols around Exchange. How do you handle that?

    Thomas Uhl

    April 1, 2012 at 3:06 am

  9. Hello!

    Any news on K9 support for EAS … Exchange 2010 today 02 MAY 2012 ?

    I have seen the k9-4.007-release.apk google code page … is this the new stable version ?

    Is the long awaited EAS support implemented?

    Thanks for info

    K9-EAS 2010

    May 2, 2012 at 11:48 am

    • I assure you, when there is news to be reported, it will be reported. =]

      Kris Wong

      May 2, 2012 at 3:04 pm

  10. Any news of this news? ;) I’m sure others echo my sentiments in looking forward to it with excitement and anticipation.

    John Markus

    June 8, 2012 at 2:56 am

    • Unfortunately the problem seems to be, everyone wants and needs it, but no one is willing to work on it. :P

      I actually haven’t worked on K-9 since January or so. While I would love to ship working EAS support, other things in my life are taking priority right now. Such is the curse of open source.

      Kris Wong

      June 8, 2012 at 7:41 am

  11. I wish I knew how to program…. Why not a paid vs. non-paid version, with the paid version being Outlook 2010?

    John Markus

    June 8, 2012 at 9:38 am

  12. The build process was easy and it works. Kudos.

    Gary Danko

    June 17, 2012 at 3:50 pm

  13. Does Kaiten (the paid version of K9 if I understand correctly) support activesync? I’d be happy to pay to support development but I don’t want to pay for Kaiten if it has the exact same problem that’s keeping me from being happy with K9.


    June 22, 2012 at 10:27 am

    • No, it does not.

      Kris Wong

      June 22, 2012 at 10:30 am

      • Aww man that’s unfortunate. Guess I can only hope someone helps code it at some point. Now I have to find another mail app that does what I need. Sigh. Thanks for your help.


        June 22, 2012 at 10:52 am


      “Kaiten supports IMAP Push, POP3, Exchange 2003/2007 (with WebDAV).”

      .. anyone can see ES2010 … or ActiveSync … :( … nope I guess

      K9-EAS 2010

      June 25, 2012 at 1:26 am

      • … just three lines from bottom in Kaiten description on Play:

        “Please note that neither K-9 nor Kaiten Mail currently support Exchange ActiveSync.”

        … good that the “K-9’s lead developer” has to mention that K-9 does not what he is not able to do … LOL

        K-9 works perfect for me … :) … except the EAS support … :(

        Erik <<< … guess your only solution now is paid Touchdown … :) … or e.g. Samsung's proprietary email client

        K9-EAS 2010

        June 25, 2012 at 1:38 am

  14. Hi Kris,

    Having the birth of my now 1 year old son and also a change of job to tackle over the last 12 months I fully appreciate how ‘real lfe’ can get in the way of hobbies and other projects so don’t get too disheartened! ;)

    Thanks a lot for taking time to type up these instructions for those of us who fancy compiling our own version of K-9 with EAS; I’m going to give it a whirl when I get a free minute…

    Best of luck in your own life fella, I hope you get some free time back soon! :)

    Paul Mulherin

    September 13, 2012 at 4:02 am

  15. […] K-9 communicates with Exchange through and outdated and problematic protocol: WebDAV. WebDAV support is turned off by default in Exchange 2007, and completely removed in Exchange 2010. This of course implies that K-9 does not support Exchange 2010. […]

  16. I would gladly pay for EAS support. I use K9 exclusively as my mail app and having started a new job would love to have EAS support built in, rather than relying on another app. I know you don’t have much time, but would it make a difference if people were willing to pay for it? Other EAS apps out there are nearly $20 and sell well, so it could be worth your while.


    October 18, 2012 at 5:36 am

    • I appreciate your willingness to support in the best way you can! =]

      I recently started a new job with a startup in Austin (, so I am working startup hours. So at this point, I have 0 free time.

      Kris Wong

      October 18, 2012 at 9:15 am

      • Have you push all the branch to Git Hub? there are too many errors! the ms-eas branch can not be made or built


        July 22, 2013 at 4:04 am

      • Hello Kris I am the designer of Zeus Mail could you write me at if you get this…thanks


        August 4, 2013 at 12:44 pm

  17. What happened to this? If this could be completed and K-9 had EAS support, it would crush ALL other email clients…


    November 13, 2013 at 9:23 am

  18. Would some level of funding help this project? ie: FSF funding, kickstarter, etc. I for one would donate/purchase. Ididnt notice any kind of donation links on the project site.


    January 17, 2014 at 8:50 pm

    • I have been working for Boxer (the best mail app available for iPhone) for a little over a year now. We are currently working on the Android version of Boxer. It’s still a few months out, but it will crush all other mail clients.

      Kris Wong

      January 18, 2014 at 11:23 am

  19. I am unable to go through your steps, it is giving me an error like
    Warning: Permanently added ‘,’ (RSA) to the list of known hosts.
    Permission denied (publickey).
    fatal: The remote end hung up unexpectedly

    Please help me out to get source of K9 with EAS.



    August 30, 2016 at 9:13 am

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: