Relinking Android Market Applications
When I initially set up my Samsung Captivate, I used my work email as the primary email address for the device. This caused my Android Market applications to be associated with my work email. When Google started allowing multiple accounts, I added my personal GMail account to the device and managed to get a confusing mix of installed applications associated with each account. After being frustrated with this for a while, I decided I needed to fix this.
The internet offered no examples of how I might go about doing this, so I went spelunking on my own. For those that may need to do something similar, I decided to capture the steps I used to relink my Android Market applications with a single GMail address. Before I go any further, let me offer some warnings:
- I AM NOT LIABLE IF YOU BREAK YOUR PHONE BY TRYING THIS.
IF YOU DON’T KNOW WHAT YOU ARE DOING, DO NOT ATTEMPT THESE CHANGES.
- My steps include a few things to hopefully avoid major breakage, however I’d urge caution. Be careful.
- Your device must be rooted in order to make the necessary changes.
- These steps only work for free applications. Paid applications are associated to a particular Google account using DRM.
- CONSIDER YOURSELF WARNED
November 13, 2011 Update
While this appears to work in the short term, I’m noticing applications slowly migrating back to the original accounts. I’m not entirely sure where those values are being stored or how to fix this permanently.
The Market Assets Database
As of this writing, Android Market (implemented by the com.android.vending package) stores the linkage between an Android application package and the associated Android Market account in the file:
The ASSETS table within that SQLITE database contains the mappings as seen in this screenshot.
Relinking applications is a matter of properly updating this table. The prerequisites for this process are:
- Rooted device
- Android Debug Tools (adb) installed and working
Start by making sure that Market application has been stopped:
- Navigate to Settings -> Applications -> Manage Applications
- Locate and select the Market application in the list
- Press the Force Stop button
Make sure that your device is attached with USB Debugging enabled:
$ -> adb devices List of devices attached 3231174E43AA00EC device
Open a shell on the device and navigate to the database directory:
$ -> adb shell # cd /data/data/com.android.vending/databases # ls -l -rw-rw---- 1 app_57 app_57 34816 Oct 29 11:55 market_assets.db
Backup the current file:
# cp market_assets.db market_assets.db.save # ls -l -rw-rw---- 1 app_57 app_57 34816 Oct 29 11:55 market_assets.db -rw-rw---- 1 root root 31744 Oct 29 11:44 market_assets.db.save
Update the database file:
# sqlite3 market_asset.db sqlite> update ASSETS set ACCOUNT = 'email@example.com' ...> where ACCOUNT = 'firstname.lastname@example.org'; sqlite> .exit # exit
At this point, reboot your phone. If all went correctly, your free applications should now be associated with email@example.com.
Updating Paid Applications
As I mentioned earlier, this process can’t be used to relink paid applications due to DRM that is tied to your account. If you want to do this, most application developers will offer a refund if you purchase on a new account and send them the order details for both the old and new accounts. Once you’ve purchased on the new account, you can uninstall for the old account and reinstall from the new. This is a lot of effort, but can help if you need to switch market accounts.