Or Continue to Thread: [HOW TO] Manuals for creating …
Find Your Device:
16th January 2009, 02:04 AM   |  #2  
Stericson's Avatar
Retired Senior Mod / Senior Recognized Developer - Godfather of Android Theming
Thanks Meter: 382
 
1,193 posts
Join Date:Joined: Nov 2008
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.


Things you will need:

The rom you intent to create a theme for... Now a days there are so many to choose from so none of this will be rom specific.

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

You'll find this on Android Development

You will also need the latest SDK and java:

Link to Java: http://java.sun.com/javase/downloads/index.jsp

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

You can also use any zipping archive to extract files from and to the update.zips. I believe there are links below to some of these.

Very Important!
You do not usually need to resign every apk that you change! Usually you only need to resign the update.zip! However there may be times that you may need to resign an apk. So dont sign the apks...if you have problems with the update then try to resign the apks.


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.


Automatic version!


Do not use this to sign APK files in Vista or windows 7! It will cause your theme to loop phones when placed on a device. Only use this to sign update files if your using those O/S's


Note, this will not work if your SDK or the path that you place this in has any spaces in the dir name!
An Example of this is c:\users\Nikki and Stephen\sdk\tools
Try to put the SDK and the contents of the zip in a dir where the names are all together and not like the one above.


I have made a batch file that will automate the entire process of setting up to use the signing tool made by JF. This batch file will set the CLASSPATH, set the PATH, install the registries, and will even allow you to sign files manually if you wish. I plan on building onto this batch file to include other things. However, for the moment, it will only include what you see here.

In order to use this you should have downloaded the sdk already. Simply extract all of the files into the tools dir of your sdk, and run autosign.bat follow the instructions and go through the options one by one, starting with 1 working through 4. You can however, put the contents of this zip anywhere on your computer and it will work. It is just better to put them into the tools dir of your SDK. Especially for the consideration of future versions.

Autosign .zip: https://docs.google.com/leaf?id=0B5A...lMWNj&hl=en_US

Want to set up the signing tool manually?

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

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

FOR XP:

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.
Secondly, Find the system variable called PATH and add to the end of it, the full path to your sdk directory.

For example, mine was c:\sdk\android-sdk-windows-1.0_r2\tools

FOR VISTA:

Open a cmd prompt.

Replace THEEXACTPATHTO-TESTSIGN with the path to the dir that holds the file testsign.jar.


Type:
echo %CLASSPATH%

If it is returns %CLASSPATH%
Type the following:
set CLASSPATH=THEXACTPATHTO-TESTSIGN\testsign.jar


If it comes back with something else then
Type the following:
set CLASSPATH=%CLASSPATH%;.;THEXACTPATHTO-TESTSIGN\testsign.jar


For Example, when I type this it looks like:
set CLASSPATH=%CLASSPATH%;.;c:\Android\SDK\tools\tests ign.jar

To set the PATH

Replace THEEXACTPATHTO-SDK with the path to the tools dir of your SDK.

Now type:

set PATH=%PATH%;.;THEXACTPATHTO-SDK\tools


For example, when I type this out it looks like this:

path-%PATH%;.;c:\Android\SDK\tools


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.


Signing the Files:

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? That's how you will resign your .apks and .zips.

When you choose it a cmd window should open for a few seconds and then close. the file you signed will be overwritten with the new resigned file.

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


General Info:


You will need to be specific in addressing what version your theme is for, RC8, RC30, or ADP1. 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 itself. To find these images open up the apk, you can rename it to .zip or open it with an archiver of your choice, winrar, winace, etc. Then after opening the apk open the folder called res and inside of that there are folders that are named Drawable, drawable-land, drawable-port, etc. This is where the images are stored.

There are 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 doing so will corrupt the .9.png and cause the image to distort. You can however compile the images with eclipse.

Editing .9.png's - http://forum.xda-developers.com/showthread.php?t=487001

Be aware, messing with .9.png's can cause problems if they are not done correctly.

If your going to build your own update.zip from scratch:

To simplify this process for you though, most rom devs provide a theme template with their roms now. You can also download someone elses theme and use their files, since they are resigned already. It may also be easier to see what files do what and go where since they have already been edited and are easy to point out.

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. or you can use your favorite archive opener.

I dont use the archive process because it can lead to very aggravating problems such as things not getting signed correctly and have heard reports of it interfering with the signing tool above. Anyways I just add zip and it works great for me.

For those renaming the .apk's to .zips

Note that if you are using windows you will need to unhide known file extension types. you can also use your favorite archiver such as winrar, winzip, etc.

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

See here to unhide file extension types for Vista: http://maximumpcguides.com/windows-v...ile-extension/


Tips:

After opening the apk copy the folder called res.
Go to your desktop, or wherever, create a new folder called Images, or whatever.
Open the folder, paste the res in there.
Now you can see what the files look like without opening them, by using thumbnails to see what they are.
Btw, you may also want to add -frame, or -launcher, to the end of the res folder you copy over to keep them separated from others.

Almost Done


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

Update script

The update script is in a Unix format, while you do not need linux you must save it in a Unix format. I suggest using Textpad to edit this script and saving it in the Unix format.

Link to Textpad: ftp://download.textpad.com/pub/textpad5.2/txpeng520.exe

XML Edits

I have provided some additional support for the process of hex editing xml files to change things like text color, size, and more things not easily changeable.

You can find this thread here: http://forum.xda-developers.com/showthread.php?t=479019

Final Notes:
Last edited by Stericson; 28th June 2011 at 10:11 PM.
The Following 5 Users Say Thank You to Stericson For This Useful Post: [ View ]