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 :
Blocked
AccessStateReason :
Policy
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: example.contoso.com, 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”

  1. Note, Google is pushing the latest froyo updates as source code, but you need to check the correct release branch in order to find them. In the Android Open Source Project page you linked to, scroll down a bit further to the section marked “tags”, and check the log or shortlog for “Android 2.2.1 release 1”. You’ll find changes as recent as 18 Sep 2010.

  2. Andrew:
    I don’t think that was the case when I wrote this article; I may have overlooked something but I thought I checked the tags/branches and they had not been updated. As there has been a push to Froyo since I wrote this, it’s possible they’ve started updating the open source edition too.

  3. This is perfect!!! I was able to do this with appInstaller without having to use the command line, FWIW.. Just enable “Unknown Sources” and install this APK.. Working flawlessly so far! Thank you!!!

  4. great tip.

    gets me syncing on a desire hd, so I can at least send email & open attachments.

    much appreciated.

  5. Great, thanks a lot ! I installed the app directly as Chris and it worked perfect. I could sync email and agenda on a HTC Desire.

  6. Hi, I used the same method to syncronize my email but today I install the latest cyanogen nightly-ds (10252010)and it is impossible syncronized with the server even I reinstall the old email.apk. Have you any idea? Thank you

  7. I’m kind of an low-level player here, but how do you gain access with ConnectBot to root using su? I see the choices local, telnet or ssh. When I try it with local, I get a error about the right usage of the mount command. I can follow your directions if you lower the grade level a few notches, please. Thank you.

  8. Pingback: Anonymous
  9. To Netnoid:

    Make sure there is a space between “remount,” and “rw”

    Bad news is my nexus one still reported the same connection error after I updated email.apk

  10. Thanks for the guide. I was able to install the new email client on my galazy S 2.2. the only issue was that every time i reboot the phone i need to install the email.apk apps via file manager.

    No sure why this happen but it is still a great fix compared to not able to send emails.

    Thanks

  11. @bgwzkd:
    I have to do the same thing each time. Reinstall from file manager. I wonder what the solution for that is?

  12. @Pedro. No solution. just reinstall everytime i reboot.

    @mx3208
    Tried you solution. Able to connect to server but not able to send emails. Cant accept and send invites.

    Went back to the email.apk

  13. @Pedro, I chnaged to a custom kernel and ROM and the email.apk seems to work fine after placing it in the app folder. dont have to install everytime i reboot

  14. I have done the following steps
    1- installed z4root and rooted my SGS I9000 Froyo 2.2
    2- installed BusyBox
    3- installed ConnectBot
    4- downloaded the Email.apk given in the above link
    5- from ConnectBot, I ran:
    su
    mount -o remount rw /system
    cp /system/app/Email.apk /sdcard/backup_Email.apk
    cp /sdcard/download/Email.apk /system/app
    6- when I try to open the Eamil app am getting the error (sorry the application email process com.android.email has stopped unexpectedly) Any Ideas? Thanks

  15. I had trouble syncing my corporate calendar from an Exchange 2010 SP1, whereas my Exchange-account on an earlier version worked just fine.

    What helped me was to upgrade to Android 2.2.1.

    Besides the improvements in Exchange, the lagging was gone. It is like a completely new phone 🙂

  16. When I run the “mv /system/app/Email.apk /sdcard/backup_Email.apk” it tells me “/system/app/Email.apk faild, cross-device link”
    Does somebody know what this tells me and what I could do do fix it?
    I have the Galaxy S with Froyo and use Terminal Emulator…
    Thanks

  17. I have an AT&T Samsung Captivate Galaxy S, my exchange has been working great with 2.1 code. I upgraded last week to 2.2 build FROYO.UCJI6, kernel 2.6.32.9 baseband I897UCJI6. The only issue I’m having now is with setting up the exchange server. I’m getting an error after doing the config that “This server requires secruity features your phone does not support”. This is where the the phone comes up and ask for a pin number in the past. Any ideas?

    thanks
    bill

  18. Oleole,

    Do you have USB storage turned on? If so, turn it off. The phone cannot access the SDCard if you have USB storage turned on. Had the same issue and that’s what it was for me.

  19. Pingback: Blog KAE
  20. mv was giving cross link issues.also cp says not found…used busybox cp to take backup instead of mv, then used rm to removed from/system/app and used busybox cp to copy from sdcard to /system/app..worked..Thanks for author for nice blog.

  21. Unfortunately when i restarted and checked Email app issue and it didnt work (sorry the application email process com.android.email has stopped unexpectedly).I have put back my old Email.apk which came with Adnroid 2.2 which i took backup. Any idea why it didnt work? i use galaxy s froyo india DDJP6

  22. Found a fix. If you are able, have your domain admin delete your account then re-add it. Make sure you export all mail to a .PST for safety. Once you do this, Android will sync. I discovered this by creating a test account on my Exchange 2010 server.Everything worked fine on 2.1 but once I upgraded my Captivate to 2.2 it failed to connect to server. Deleted and recreated my account (domain admin) Android 2.2 setup flawlessly.

  23. To fix the problem disable ActiveSync Default Policy in Exchange 2007/2010

    In Exchange Management Shell paste the following command:

    Set-ActiveSyncMailboxPolicy “Default” -IsDefaultPolicy $False

    ISLOCK.COM

  24. Ba-rilliant!
    This solved the same problem I had on a ZTE Blade (Swedish Telia) that I just updated to their official Froyo release.
    Temp root access using Z4root.
    Connectbot like the article above.
    Using Z4 I did not get CP to work but could use busybox cp like Rajesh commented above (thanks!)
    After Email.apk has been moved to /system/app it has change file mode, do this with the command “chmod 644 Email.apk” and you are done.
    My email now works fine after a reboot. =)

    Thanks Laurie and all commenters!

  25. Thank you for this fix. I’ve been flashing all sorts of different roms on my work Droid, but only when I flashed CyanogenMod 6.1.2 (my preferred rom until Gingerbread gets better and not killing my home app and widgets) did I have problems with the built-in email client. I used adb from my computer; it’s easier than typing in a terminal on the phone for me, and since I already have the adb drivers installed for rooting with super1click, it was quick and easy. I also chose to chmod the permissions to 644.

  26. I don’t know what you have done but you are genious…. !!! Thanks … it works for me… when I typed what u said….

  27. All,

    Just in case it has been missed this may not be required. I nearly went this solution only to realise that Exchange 2010 has a 10 device (ever) connected per user account. Open OWA and go to settings, then phones. Remove all the old devices you have connected (or when you reset your phone to defaults). If your lucky, like me, magic, it all works. I nearly purchased Touchdown which somehow seemed to work around this issue but was still using ActiveSync.

    Hope this helps someone.

  28. This worked great for me up until my Droid 2 updated to operating system 2.3 gingerbread this week. When I hit the options button to create a new email I now get “the application Email (process com.android.email) has stopped unexpectedly. Please try again” error. Anyone have a fix?

  29. After long 3 hour efforts, i just managed to connect my galaxy tab 7″ with exchange server 2010 once again. Not sure if i understood right, but i had to delete/rename both email.apk and email.odex files from the /system/app folder. then i copied the latest Email.apk. Even without restarting, my email application connected to Exchange Server 2010.

    Wow!! solved the mystery after almost 6 months!!

Leave a Reply to Chris Cancel reply

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