[G1 Android Development] Stericson:
Note - A user has complained that this hack has the possibility of crashing your market program if implementing. Although it has not happened to anyone that I am aware of, it is still something to consider when doing this! The user cites that when running DDMS from the android sdk a long list of errors is generated refering to this hack, I ran the same tool and didnt see any errors. This doesn't mean however that it isn't true, so, you should take this into consideration before you attempt this. Remember, you are responsible for your own device and what you do to it is your own doing and noone else's. Personally, I am still using this mod with no problems. Your results may vary!

So, as many of you are aware the market app continues to grow and eat up space..well, since having root it has been one of my priorities to figure out how to reduce the apps size and/or force the phone to save whatever data is causing the app to grow on the sdcard. Well, I have officially gotten it all figured out....

In order for you to do this you will need root access, look around on the forums to find out how to gain root access, also if you updated to the official rc30 then you are out of luck, sorry.

I am not responsible if you brick your phone by doing this! This shouldn't brick your phone, but if you do something stupid or wrong and it does brick your phone...then it is all your fault and noone elses! Be forewarned.

First off, if you would like to simply clear the cache that is causing the market app to grow then you need to obtain root on your phone. There are several different methods depending on how your phone is currently set up. For myself, I just have to open terminal emulator and type my secret word, for other you may need to type su, note that this applies to those using the modified rc30 update.

Next, simply type:

rm -r /data/data/com.android.vending/cache/*

That's it! go check the market application and you should be pleasantly surprised to find that it is now down into the kb range and not the mb range, mine was 11mb when I did this.

You will have to clear this cache every now and again as it builds up again unless, you do the following:

Obtain root and type the following commands:

Capitalization is important!

mount -o remount,rw /dev/block/mtdblock3 /

mkdir /sdcard/marketcache

mkdir /sdcard/marketcache/cache

mkdir /sdcard/marketcache/cache/webviewCache

cd /data/data/com.android.vending

rm -R cache

ln -s /sdcard/marketcache/cache cache

cd cache

ls

At this point make sure that you see webviewCache after you type ls

if you do, great, then you are all done and the market cache should now be stored onto you storage card.

if you don't then type the following:

mkdir /sdcard/marketcache/cache/webviewCache

ls

Now you should see the folder webviewCache and you should be done!

You can see this working by going to settings --> sd card & phone storage.

Make a mental note of your sdcards free space and your phone's free space.

now press the home key

open the android market

Browse a bunch of applications, the more the better.

now hold your home key down and go back to settings.

Look at your phone's free space and your sdcards free space.

The phone's free space should be the same and the sdcard's free space should be lower.

now press the home key

now obtain root on your phone once more.

type the following:

rm /sdcard/marketcache/cache/*

hold the home key down and go back to settings.

did your sdcard's free space go back up?

You can also use a file manager to look at the cache files on your sdcard now.

Btw, if you want to undo the changes simply follow this:

Obtain root

rm -r /sdcard/marketcache/cache/webviewCache

rm -r /sdcard/marketcache/cache

rm -r /sdcard/marketcache

mount -o remount,rw /dev/block/mtdblock3 /

rm -r /data/data/com.android.vending/cache/webviewCache

rm -r /data/data/com.android.vending/cache

mkdir /data/data/com.android.vending/cache

mkdir /data/data/com.android.vending/cache/webviewCache

That should do it.

If anyone has any questions let me know!

Stericson