Grokking Android

Getting Down to the Nitty Gritty of Android Development

Using your Google Account in the Android Emulator

By 28 Comments

Whenever you need to access the People or Calendar app and want to add contacts or events you need an account. On the emulator though no account exists by default. So in this blog entry I am going to show you how to add your Google account to your emulator.

Update: Google has dropped support for the ActiveSync protocol (Exchange support) for new accounts.

For existing accounts the method in this post still works. For new accounts that's no longer the case. Should I find a solution for new accounts, I will update this post.

First of all you have to go to the settings and select "Accounts & sync":

Settings - Selecting "Accounts & sync"
Settings - Selecting "Accounts & sync"

You see the list of accounts - which in the emulator should be emtpy:

Accounts & sync - Showing no accounts
Accounts & sync - Showing no accounts

After you have clicked on "Add account" you will see the selection of sync providers available. In the emulator the following two should be listed. The first one is the Exchange sync adapter, the second one is for email only. So you should select the "Corporate" type:

Add an account - Selecting the account type
Add an account - Selecting the account type

In the next step you have to enter your Google-account credentials as usual:

Add an Exchange account - Entering your credentials
Add an exchange account - Entering your credentials

The next step is not that straightforward. To use your Google account as an Exchange account you first have to change the presented domain username to your email-address again. Android by default chooses another name based on the mail-address you entered before. But this default domain name does not work here.

You also have to change the server to "":

Account setup - Entering the account details
Account setup - Entering the account details

Now if you hit "Next" you are nearly done. You might want to check if the correct check marks are set, but the defaults should normally suit you well.

Account settings - Selecting sync settings
Account settings - Selecting sync settings

In the last step you can change the name of this account and after hitting "Next" once again, you are done.

Account setup - Setting the name of the account
Account setup - Setting the name of the account

Your newly created account is now listed in "Accounts & sync" screen and the initial synchronization has already been started. If you have mails or appointments you should notice notifications popping up soon. And your contacts and events should show up in the respecting apps.

Accounts & sync - Showing the new account
Accounts & sync - Showing the new account

From now on you can use the Calendar app to create and edit events on your device and have them synced with your account.

If you have any other suggestions that might help or tips on how to improve development on Android, please let me know in the comments section.

Wolfram Rittmeyer lives in Germany and has been developing with Java for many years.

He has been interested in Android for quite a while and has been blogging about all kind of topics around Android.

You can find him on Google+ and Twitter.

28 thoughts on “Using your Google Account in the Android Emulator”

  1. Thank you, thank you, thank you! This really made my day!

    I still wonder why it was disabled to register a Google account the normal way. It was possible in earlier SDK versions. One could even access the market like on a regular phone!
    Using the emulator to debug and test apps that use PIM data is almost impossible without a Google Account registration!

    (Makes me wonder if they simply forgot about this workaround 🙂 )

    1. Wolfram Rittmeyer

      Glad, I could be of help. Are you sure about the market? I’m using the emulator for two years now and I think I have never seen it.

      1. Yes, I am sure. When I first started with the Android SDK I was using Cupcake 1.5. (must have been SDK 3 or 4). I just bought a Samsung Galaxy i7500 and used the SPare Parts app on my phone. I then wanted to try some of those features on the emulator and installed it simply using the market after simply registering the emulator with my Google account, just like I did with my actual phone.
        I cannot find the original SDK 3 or 4 anymore. Simply setting up an emulator targeting those SDK’s won’t work 🙁

        (PS., Sorry for my late response)

      2. I don’t have the “Accounts & sync” option under the Settings menu.
        I have an “Add Account” option under “Accounts”, but it doesn’t works. Nothing happens when I tap on it.

        I am using the latest ADT Bundle SDK.

        Are there any other options to add my Google account to my emulator?
        thnx in advance

  2. Thanks 10^6!!! I can’t believe how long it took to find this article. There are dozens, perhaps hundreds of posts all over the net asking this question and not one of them contains the complete and straightforward information presented here. How you ever figured this out is beyond me, but I’m glad you did.

    This also seems to work with much earlier version of Android and you don’t have to install the Google APIs. Why doesn’t Google support their own bloody system?

  3. Hi, Thanks a lot. It worked charm.

  4. Hi,
    I don’t have the “Accounts & sync” option under the Settings menu.
    I have an “Add Account” option under “Accounts”, but it doesn’t works. Nothing happens when I tap on it.

    I am using the latest ADT Bundle SDK.

    Are there any other options to add my Google account to my emulator?

    1. hi beni, i m also going through a same issue as of your’s.did you find any solution to this..if any.? kindly help me out.

  5. Thanks a lot.. is useful information.. now i am able to access my gmail account in AVD emulator

  6. Thanks, and Bundle of thanks…….
    Your tutorial was very helpful and I solve my problem after 4 days because of your good work… Thanks again, Nice work.

  7. thanks

  8. I’ve followed the steps above to try and sync my gmail calendar on my ICS emulator in Eclipse. I see my gmail account in Accounts and Sync – Sync is ON but when I open up the Calendar in my emulator, I cannot see my gmail calendar. Neither can I add events as there is no calendar on the emulator.
    My emulator is set up for Android 4.0 API 14

    Any ideas please?

  9. Update to my previous. After a restart of my emulator (classic), I can now see my gmail account in the ‘Calendars to display’ and I can add an event on my emulator yay! BUT, how come events are not synced between my emulator calendar app and my gmail calendar? If I’m not mistaken, I thought they were meant to sync?

  10. I was able to get this to work a month or so ago on an enulator running API 15, but I’ve been trying for the last couple of days on emulators running on API 16 without any luck at all. I get either of the foolowing error messages:

    1) If I use “”, I get the error message: “Username or password incorrect”
    2) If I use “”, I get the error message: “You don’t have permission to sync with this server. Contact your server’s administrator for more information.”

    Any ideas what could be going wrong here? Is there a different way to approach this? I really need to get my contacts into the emulator for testing purposes!

    By the way, in the API 16 version, there is a new “Port” field which is set to 443 by default (when SSL is checking).

    1. Please reply back in case you a get solution to your problem. I am facing the same issue.

    2. Wolfram Rittmeyer

      For new accounts Google no longer supports the Exchange protocol ActiveSync. For existing accounts everything should still work.

      Should I find a new way for new accounts I will update my post.

    3. Hi v,

      I am also getting the same problem..did u get the solution of it. If yes then plz reply , i will be thankful to you

    4. Hi V. Where you able to fix this? I am working with API 16 as well and haven’t been able to get it working.

  11. Hi, Every one … I am trying to send automatic email from my application with out UI… Can you help me in that…. I find lot of code Javamail but that not works here…. i am using emulator 4.0…

  12. Adding a Google Account on your emulator will work with the following emulator setup.
    Eclipse > Window > Android Virtual Device Manager
    In the device manager click “new”
    Insert the name of the device you will be creating. Ex. Nexus-4-18-Google-API
    In the device dropdown select: Nexus 4
    In the target dropdown select: Google API’s (Google inc.) – API level 18
    Click “OK” to create de emulator.

    If this option is nog available in the target dropdown you’ll need to add it in the “Android SDK manager”
    Eclipse > Window > Android SDK Manager
    Select “Google” APIs under “Android 4.3 (API 18)”
    Install package
    Now the “Google API’s (Google inc.) – API level 18” option should be available in the target dropdown.

    Once you’ve started the emulater go to:
    Settings > Accounts > add Account > Google
    Enter your Google credentials and your done!

    1. Thank you Mikael. Your post help me to configure google account and send mail form AVD emulator.

  13. hello sir,

    Suppose I am creating one data-tabel in mysql database and than in this table I am entering some data like dates (Event date) so this events are binding in to calendar it is possible??

    1. Wolfram Rittmeyer

      I’m not sure I get your question. If you want to sync data between your db and devices you have to use a sync adapter.

      But this has nothing to do with the topic of this post, so maybe I just didn’t get your question.

  14. These are my screens

    corporate ->
    account setup ->
    manual setup ->
    exchange ->
    account setup -> uname, pass, server,port,security type,clint cer, dev id

    here port no: 443(defaultly coming).

    here after clicking next saying could not open connection.

  15. Trần Thị Hằng Nga

    thanks very much. I found solution for this problem and I tired about it. And I feel lucky when find your website. Thank you from my heart.

  16. after selecting server it popup with dialogue box.
    Couldn’t open connection to server

    testing on android version 2.1 and above.
    please help me out

  17. same problem here also

  18. This blog is great!!!. Perhaps tge best blog for learning android. It has cleared my concepts of android Content Provider.
    Kindly keep on adding more tutorials on other concepts also.
    Must appreciate the author for their contribution.

Leave a Reply

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