Adding a second Gmail account in Android

This has been bothering me for a while. Whenever I tried to connect secondary email accounts in Android (by pressing the Menu button -> Accounts -> Add Account), it would ask for my login and password, and then attempt to connect to the Gmail servers. And fail, with this error: “Can’t establish a reliable data connection with the server”.

I tried it over 3G, I tried it over wifi. Neither worked, so I gave it up as a connection problem and tried again a few hours/days/weeks later. Finally I realized that this must be some kind of Android Gmail bug and went looking for a solution/workaround. So here it is:

  1. Open up the YouTube app on your Android phone
  2. Press the menu button and sign into My Account with the credentials you want to add to Gmail.
  3. Once you’ve logged into YouTube successfully, close the app and open Gmail.
  4. Open Accounts from the menu – your account should now show up and you just have to fetch the mail.

Pretty simple, right? Android just needs to link the account to your phone somehow, and the YouTube login must use a different code path. This also works for Google Apps accounts, btw.

Source: comments.