Having trouble adding a Google account? This worked for me.

drake22

Member
Oct 9, 2010
10
2
0
Visit site
Hello everyone,

This is my first time posting at androidcentral. I just wanted to share a solution that I figured out to a problem that many people (including me) have had with Android. The issue at hand is the inability to add a Google account, after the initial boot-up, to sync with your Android phone (it times out and claims you do not have an Internet connection when you do). Solutions that I found on the web ranged from clearing the caches on all Google programs to signing in using Youtube first and then adding the account to completely clearing your phone and starting fresh. Doing a factory reset seems to be the only way that I could find works 100% of the time for most people. I figured out a new solution that I think will work for most or all people that do not want to completely wipe their phone (I sure didn't).

BEFORE YOU PROCEED: COMPLETE THIS PROCEDURE AT YOUR OWN RISK. I am NOT RESPONSIBLE for your borked phone or for any bad things that may happen due to you following the steps I have posted. That being said, I will gladly try and help you complete this procedure if you have difficulty.

Please note: I did this procedure on a Samsung Epic 4G running Android 2.1 Eclair with the Epic Experience v1.1.10 ROM and the SPH-D700 Hero Over 1.3ghz voodoo DI18 kernel installed.

The short explanation of the solution is that it consists of copying the accounts database and xml files to a computer, adding the accounts and sync settings manually, and copying back to your phone (root is required to copy back to your phone). Here is the more in-depth process:

1. Open up a terminal emulator on your phone and type the following commands:
cp /data/system/accounts.db /sdcard
cp /data/system/sync/accounts.xml /sdcard

2. Copy accounts.db and accounts.xml files from your SD card to a computer with sqlite3 (download from here: SQLite Download Page) and any text editor installed (I used an Ubuntu 10.04 server with vi).

3. Open a command line and navigate to the directory where you copied accounts.db and accounts.xml

4. Type this command:
sqlite3 accounts.db

5. This should bring you to the sqlite3 command line. Type this command:
select * from accounts;

6. Each row of the table should start with a number. Pipe (|) symbols denote deliniations between columns within a row. i.e.
4|fubar@gmail.com|com.google|fjkasdh236478935129785yhaefuwbn892==​
is a single row with 4 columns. The columns are the number 4, fubar@gmail.com, com.google, and the encrypted (hashed?) password. The first column is and index number. Each row has one and it starts at 1 for the first row and increments by 1 for each row (i.e. 1, 2, 3, 4, ..., n). There should be one row in this table for every account that you have added to your phone. Make note of the index for the last row shown (mine was 3).

7. Type a variant of this command substituting your own information in and taking care to use a value for the first row that is one more than the highest index shown when you did the 'select' command and leaving the last column, password, blank:
insert into accounts values(5,'foobar@gmail.com','com.google','');

8. Type this command to exit sqlite3:
.exit

9. Copy accounts.db back to the SD card on your phone.

10. Open up accounts.xml into a text editor. accounts.xml appears to store all of the syncing settings for all of the Google accounts that are synced to your phone. I am not sure editing accounts.xml is necessary, so feel free to try and skip these steps, but I did these steps myself.

11. Copy all of the lines pertaining to one of the Google accounts (there were five lines for each account for me) that already exist and paste them just before the last ending tag (which is </accounts>).

12. Edit all of the id="n" lines in the lines you pasted so that the number n increments by one for each line (following the pattern already apparent in the file).

13. Change all of the account="fubar@gmail.com" in the lines you pasted to be the correct e-mail address for whatever Google account you are adding.

14. Optionally, change or add enabled="false" and/or syncable="false" to each line as you see fit for what you want to enable and sync on your account.

15. Copy accounts.xml back to the SD card on your phone.

15. Mount the SD card on your phone, open up a terminal emulator, and type the following commands (this is where root is required):
su
cp /sdcard/accounts.db /data/system
cp /sdcard/accounts.xml /data/system/sync

16. Restart your phone.

17. Go to settings > Accounts & Sync when your phone comes back up and make sure that the account you added is there now. When your phone tries to sync, it will alert you that the password for your new account is bad (which makes sense since you put in a blank password if you remember ;) ). Put in the correct password and hit "Ok" or "Sign in" or whatever. It should sign in and sync.

Voila! :cool:

I know how frustrating it is to not be able to add an account and have everyone tell you the solution is to "delete everything and try again". What a load...

As I stated above, please reply to this post or send me a private message if you need help. I will get back to you as soon as I can and try to assist you as best as I can.
 
Last edited:
  • Like
Reactions: ragnarokx

jpfoxey

Active member
Oct 19, 2010
43
0
0
Visit site
any easier fixes, this seems crazy for a new phone running android, thanks for your help, the above instructions seem miles over my skill set