Fixing Android Market When Stuck

Recently, I was having trouble with the Android Market after I’d upgraded to CyanogenMod 6 on my HTC Dream. Since the Dream has really limited internal space, the CyanogenMod folks removed Google Maps from the Google Apps package, since Maps can be installed from the Market. Right after I’d gotten my phone up and running, I’d set it to install a bunch of stuff from the market, including maps.

Now, Maps is a huge application by Android standards, but it has an enormous amount of functionality. And even though Froyo supports saving apps to an SD Card, I can’t seem to get it to install from Market to the SD Card, so I quickly filled up the internal storage and had several app installs fail, including Market. Now, several of these Apps are not ones I particularly cared about, but this weekend Catherine and I went on a day trip where I really needed the Maps.

However, Maps thought it was already downloading (it wasn’t), even after multiple reboots, and attempts to cancel the download within Market caused a force-close. However, it is possible to fix. Since my device was rooted, and had a terminal emulator I was able to do it on the phone in the car, but it would be fully possible to do it from the Android Debug Bridge with the phone plugged into a computer.

Once into the device via a terminal you’ll want to do the following:

  1. Make sure you have root access (should be automatic via adb, su otherwise)
  2. cd /data/data/
  3. sqlite3 assets.db
  4. `DELETE FROM assets10 WHERE state = ‘DOWNLOADING’;

When you go back into Market, you should be able to tell the app to begin downloading again, and it should just work. Oh, and don’t do this when you do have a market download that is legitimately in progress, because I suspect something bad would happen.