Fixing Android 2.2 Sync after Upgrading to Exchange 2010 SP1

Last night I upgraded my Exchange 2010 server to 2010 SP1. Unlike many other people’s experiences, this actually went rather smoothly, until I realised 2 hours later my T-Mobile G1 (aka HTC Dream) is no longer syncing my Email. I currently use Cyanogen’s Mod version 6 which brings the features of Android 2.2 aka Froyo to my poor ancient device (which I’m hanging on to because of the excellent keyboard!) and use the built-in Exchange ActiveSync (EAS) support to sync my email, contacts and calendar to my phone.

I read online about a few other people running Android 2.2 who had the same issue and some suggested it was a policy problem, so I deleted the default profile and recreated it, and deleted the device association on my phone and my account. Unfortunately this didn’t work either, leaving me with no email but more importantly, no contacts!

After enabling some extra logging on the server I could see it was unhappy about Android trying to get a folder sync without provisioning, but for some reason the device wasn’t attempting to apply the policy.

AccessState :
AccessStateReason :
ResponseHeader :
HTTP/1.1 449 Retry after sending a PROVISION command
MS-Server-ActiveSync: 14.1

Curiously, enabling extra logging on the device just showed it successfully understanding the first OPTIONS request, then timing out.

[12:36:00] EAS SyncManager | !!! EAS SyncManager, onCreate
[12:36:00] AbstractSyncService | Testing EAS:, domain\user, ssl=1
[12:36:14] AbstractSyncService | Validation (OPTIONS) response: 200
[12:36:14] AbstractSyncService | Server supports versions: 2.0,2.1,2.5,12.0,12.1,14.0,14.1
[12:36:14] AbstractSyncService | Try folder sync
[12:36:35] AbstractSyncService | IOException caught: Read timed out
[12:36:35] EAS SyncManager | !!! Eas SyncManager, onDestroy

Thinking I was going to have to apply my highly dubious Java programming skills to this solution, I downloaded the Android SDK and started up the emulator for 2.2. I attempted to set up my account on the emulator, and to my surprise it worked first time.

I can only imagine, Google have already patched up this issue and not yet released it, as the Android Open Source Project page for Mail.apk shows the last update 5 months ago. So I applied the best logic that I have as a Sysadmin… Scp the working Email.apk from the emulator to my server, and install it on my device. And it works! I lose the a few additions that have been made to the CyanogensMod version of Email.apk but I’d rather have it working.

If you’re experiencing this issue too and you want to apply my brute force method of fixing it and get your email syncing again, simply follow these instructions (you need root for this, but I suspect this is only a problem on modified builds):

  1. Download the 2.2 stock Email.apk from here using the Android browser. Don’t attempt to install it, let it go in to your download folder on your SD card.
  2. Open a terminal on your device. I use ConnectBot. Gain root using “su”
  3. Run: mount -o remount,rw /system
  4. Run: mv /system/app/Email.apk /sdcard/backup_Email.apk
  5. Run: cp /sdcard/download/Email.apk /system/app
  6. Reboot for good measure
  7. Set up your sync, and enjoy a refreshing beverage
    for your hard work

Disclaimer: I have no idea if this has any bad affects on your phone, your sex life, or anything and I make no guarantees about anything. If anything bad happens, it’s not my fault, you do this at your own risk! The process above makes a backup, so hopefully if you regret this you can put back the old version.

52 thoughts on “Fixing Android 2.2 Sync after Upgrading to Exchange 2010 SP1”

Leave a Reply

Your email address will not be published. Required fields are marked *