[G1 Android Development] Stericson:
To create themes, or to edit themes to your liking, you will need a working knowledge of android, adb, how to resign apk's, knowledge of your own O/S.

Before you start be aware that you will probably end up wiping your phone once, if not more. So lets go over the things that you will need.

You will need JF's RC30, RC8, or ADP1 V1.3, depending on what version you intend to create for.

Here is the link to these: http://xdaforums.com/showthread.php?t=466174

You will also want to get the dev bootloader installed on your phone and to HIGHLY suggest everyone trying your theme to install it as well.

Link to dev bootloader: http://xdaforums.com/showthread.php?t=455860

You will also need to resign all the apks located in /system/app and framework-res.apk located in /system/framework. When you push all of these to your phone, you will need to do a wipe.

JesusFreke was kind enough to build a custom signing tool for me that would allow me to right click on an apk and resign it from there. I am posting it here for others to use as well. Note that this is a courtesy of JF, so thank him for it. I cannot stress how much time this has saved me and will save you.

Here is the link: Http://www.FightForthePits.com/testsign(2).zip

Before using this you need to know how to set this up:

I will assume that you have the sdk downloaded and extracted somewhere(if not, do that now), extract both files to the tools directory of your sdk.

Now you will need to add the tools dir of your sdk to the environment variable CLASSPATH.

To do this, right click on My Computer click properties, then choose the tab that says advanced. Click the button that says environmental variables. Go to system variables find the one that says CLASSPATH, double click it, go to the end of variable value. There should be a semicolon ; at the end. type in the path to the testsign.jar located in the tools directory of your SDK, for example the path to my testsign.jar was c:\sdk\android-sdk-windows-1.0_r1\tools\testsign.jar If CLASSPATH is not in your system variables then create it.

If you find the right click menu not working for some reason you can type the following in cmd to sign your files: java testsign whateverfiletosign

Now right click the reg file that you extracted and choose to install it, or merge.

Now, right click an apk, do you see an option that says ResignApk? If not hit the windows key and R at the same time. Type in regedit. go to HKEY_CLASSES_ROOT and expand it. Now find .apk and click it. Double click on (Default) and erase apk_auto_file. Hit ok and close the Reg editor. Now right click an apk and the option ResignApk should be there.

Now through doing this you have done two things, first off you have made the resigning process extremely easy, secondly you will not have to cd to the tools dir of the sdk to use adb or any other tool in the sdk.

You will also need a version of linux installed or running vmware with linux, so that you can create an update file which will install the theme onto the users phone.

You need to make sure that you do this correctly, because if you don't then you will have the potential to create problems for people trying to install your theme. You also need to be specific in addressing what version your theme is for, RC8, RC30, or ADP1. Make sure every file gets signed. Make sure you test the update.zip before you release it.

Every .apk contains the images relating to itself. However, every apk has the ability to use the images in framework-res.apk. The images for every apk is located inside of res and more specifically in folders that are named Drawable, drawable-land, drawable-port, etc. Some things you cannot edit unless you rebuild the entire apk from source, which we will not go into here.(another tutorial, another time) Just know that at this time you SHOULD NOT edit, or even open images with the extension .9.png. If you do you will have problems...Trust me. These are special images called ninepatch images and android resizes these images to fit wherever android, or any other apk, needs it to. if you do open them or edit them they will no longer render correctly when resized. I believe that in order to edit these you must do so and then put them into the source and rebuild the entire apk.

Before getting started you must also realize that you cannot simply resign one or two apk's and stick them in your phone and expect them to work. You must resign every apk inside of /system/app and framework-res.apk and put them on your phone at the same time.

To simplify this process for you though, I have provided an update which will do all of this for you. Note that these updates will not completely wipe your phone, your apps will be retained, however, they will require you to re-enter your Google info, and you will lose you call history.

Links down

Just put the correct update.zip, depending on what version you are running, onto your sd card, boot into recovery and hit alt + s.

Now you can push your own apk's one at a time without re-wiping your phone.

Now, your ready to start changing things up.

You will now need to open the apk, which you can do by adding .zip after .apk, effectively changing it to a zip. Note that if you are using windows you will need to unhide known file extension types.

See here to unhide known file extension types for Xp: http://www.mediacollege.com/microsoft/windows/extension-change.html

See here to unhide file extension types for Vista: http://maximumpcguides.com/windows-vista/how-to-change-a-file-extension/

After changing the apk to a zip open it go to res and copy the folders that have drawable in their name. Go to your desktop, or wherever, create a new folder called Images, or whatever. Open the folder, paste the drawable folders in there. Now you can see what the files look like without opening them. Btw, you may also want to add -frame, or -launcher, to the end of the folders you cope over to keep them separated from others.

Finally, you've edited the images put them all in the apk renamed it back to an apk and resigned it. Now it's time to push it to your phone and see the changes you've made.

Important! : Whenever pushing files to the phone NEVER do it while the phone is running. Do this in recovery mode! If you do this while the phone is running normally you will begin to lose space in /system.

So, boot into recovery plug your phone in and open a cmd prompt. From the cmd prompt type adb shell mount /system then type the following: adb push c:\whereveryourfileis\whateveryourpushing.apk /system/app (system/framework if your pushing framework-res.apk)

Now reboot your phone. If it doesn't boot, try doing a wipe, if that doesn't work reinstall an update and try again. There are alot of things people can do wrong, I can't explain them all here. If you get real stuck, you can ask for help here or contact me on Gtalk Stericson.G1@gmail.com.

So now your theme is done and your ready to make an update.zip for others to install your theme.

This must be done in LINUX! Not WINDOWS! Yes it may work for you if you do it in windows but other people's phones will enter an indefinite loop! Just do it from Linux! If you absolutely cannot make your own update.zip, contact me and we'll see if I can make one up for ya.

I have created a template for you to make your own update.zip. Just download, open in Linux, and add the system apps to app, and framework to framework. Zip it up, SIGN IT, TEST IT YOURSELF, and then distribute it!

Empty update.zip template: Http://www.FightForthePits.com/Androidstuff/update_empty.zip

If anyone has any questions please try asking for help in this thread before emailing me for help :) Usually I will respond to questions in this forum.

I hope this Tutorial has been helpful. I will add on to it as needed.

Stericson

Links of interest:

Downloading SDK: http://code.google.com/android/intro/installing.html

Using ADB: http://code.google.com/android/reference/adb.html