ZArchive Manages Your File Archives

Today smartphones are quite powerful devices that can handle multiple processes at once. In fact, some of … more

Regain Double Tap to Wake Functionality on the Nexus 6

A few months ago, Google announced its newest flagship device, the Nexus 6, alongside … more

Clean Your Recent Apps – XDA Xposed Tuesday

In this day and age, you have quite a few apps installed and running on your Android … more

Android Studio Reaches Release Candidate Status

Android app developers have a few options when comes to Android IDEs. One of the most … more

Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

How-to Theme Development

OP Stericson

2nd January 2009, 12:22 PM   |  #1  
Stericson's Avatar
OP Retired Senior Mod / Senior Recognized Developer - Godfather of Android Theming
Thanks Meter: 393
 
1,198 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.

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://forum.xda-developers.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://forum.xda-developers.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/microsof...on-change.html

See here to unhide file extension types for Vista: http://maximumpcguides.com/windows-v...ile-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/Andro...date_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
Last edited by Stericson; 7th January 2009 at 04:20 PM.
2nd January 2009, 12:29 PM   |  #2  
jashsu's Avatar
Senior Member
Thanks Meter: 14
 
1,853 posts
Join Date:Joined: Nov 2008
Working with ninepatch should be straightforward if you use the draw9patch tool included in the SDK. Documentation on usage here:

http://code.google.com/android/refer...raw9patch.html

JF could also save theme users a wipe by resigning /system/app/* and /system/framework/framework-res.apk in his builds with the test keys. Nice tutorial, btw.
Last edited by jashsu; 2nd January 2009 at 12:34 PM.
2nd January 2009, 12:31 PM   |  #3  
Stericson's Avatar
OP Retired Senior Mod / Senior Recognized Developer - Godfather of Android Theming
Thanks Meter: 393
 
1,198 posts
Join Date:Joined: Nov 2008
However it doesn't. I have used that to no avail. I believe you need to edit the images, put them in the source then rebuild the apks from the source.


As for JF's update, it does not currently wipe your phone after install. So, for him to do this he would have to have his update do a wipe. So technically, they would still have to do this initial wipe.

Stericson
Last edited by Stericson; 2nd January 2009 at 12:37 PM.
2nd January 2009, 01:05 PM   |  #4  
jashsu's Avatar
Senior Member
Thanks Meter: 14
 
1,853 posts
Join Date:Joined: Nov 2008
Quote:
Originally Posted by Stericson

However it doesn't. I have used that to no avail. I believe you need to edit the images, put them in the source then rebuild the apks from the source.

Good point. I thought you could simply drop a similarly dimensioned PNG in but apparently there is some metadata that only the android tool can create.

Quote:

As for JF's update, it does not currently wipe your phone after install. So, for him to do this he would have to have his update do a wipe. So technically, they would still have to do this initial wipe.

True, but a user who is upgrading to a JF update after having put in customized (and test-key signed) system apps will have to wipe again anyway =) Anyone using custom themes will have to wipe every time a JF update (or any update) comes out. However if JF resigns, custom theme users would not have to wipe and stock theme users only have to wipe once. (Nevermind the fact I think everyone should wipe when updating...)
2nd January 2009, 03:35 PM   |  #5  
kron2's Avatar
Senior Member
Thanks Meter: 1
 
475 posts
Join Date:Joined: Mar 2008
thx stericson this will help big time how long before I can get resigned rc30 last night when you said all the apk. need to be resigned I was like this is going to be a long night but I see jf hooked you up save some big time with his resigning tool
2nd January 2009, 07:47 PM   |  #6  
Stericson's Avatar
OP Retired Senior Mod / Senior Recognized Developer - Godfather of Android Theming
Thanks Meter: 393
 
1,198 posts
Join Date:Joined: Nov 2008
Quote:
Originally Posted by jashsu

Good point. I thought you could simply drop a similarly dimensioned PNG in but apparently there is some metadata that only the android tool can create.

True, but a user who is upgrading to a JF update after having put in customized (and test-key signed) system apps will have to wipe again anyway =) Anyone using custom themes will have to wipe every time a JF update (or any update) comes out. However if JF resigns, custom theme users would not have to wipe and stock theme users only have to wipe once. (Nevermind the fact I think everyone should wipe when updating...)

Ah, good point

The resigned apps will be released maybye sometime tonight...I had them done but ran into a script problem on adp1 and I have yet to try the rc30 and rc8 ones yet. so I won't release those until I've tested them. If you want to be a Guinea pig however, just let me know

Stericson
Last edited by Stericson; 2nd January 2009 at 07:50 PM.
3rd January 2009, 07:02 AM   |  #7  
Stericson's Avatar
OP Retired Senior Mod / Senior Recognized Developer - Godfather of Android Theming
Thanks Meter: 393
 
1,198 posts
Join Date:Joined: Nov 2008
Quote:
Originally Posted by Stericson

Ah, good point

The resigned apps will be released maybye sometime tonight...I had them done but ran into a script problem on adp1 and I have yet to try the rc30 and rc8 ones yet. so I won't release those until I've tested them. If you want to be a Guinea pig however, just let me know

Stericson

The resigned apps have been released, each update file will resign all of apps in /system/app and framework-res.apk. However, these updates make no changes to them whatsoever...Meaning your phone will look just like a brand new phone without any modifications.
3rd January 2009, 05:28 PM   |  #8  
kron2's Avatar
Senior Member
Thanks Meter: 1
 
475 posts
Join Date:Joined: Mar 2008
rc30 works thx Stericson made it easy for use
4th January 2009, 07:26 PM   |  #9  
Junior Member
Thanks Meter: 0
 
9 posts
Join Date:Joined: Jan 2009
Issues with using the update.zip above
Hi all,

I just wanted to point out that after I applied the update.zip above and rebooted applications kept force closing randomly and constantly even through the initial setup (where you have to click the green android to start).

Prior to this, I had JF's RC30 1.3, and the engineering bootloader V2 no sigcheck.

First I did just a alt+s then a alt-w and alt+s. And still nothing.

I'm new to all this so I'm not even sure where to begin troubleshooting. Should I be using the HardSPL?

Thanks in advance and I appologize if this isn't the right place for this post.

Update:
After reflashing with JF's 1.3 RC30 and the problem persisted I noticed that there was a new release 1.31 and this has fixed the problem. I hope this helps anyone else who runs into the same problem.

I still don't know what went wrong though, can anyone shed some light on this? thanks.
Last edited by limitlis; 4th January 2009 at 07:45 PM. Reason: Update
4th January 2009, 09:14 PM   |  #10  
Stericson's Avatar
OP Retired Senior Mod / Senior Recognized Developer - Godfather of Android Theming
Thanks Meter: 393
 
1,198 posts
Join Date:Joined: Nov 2008
Truly there's no telling, sounds like J'f's update fixed it. Can I ask what version you tested?

I would also like to announce that now, thanks to JF, again, you do not have to wipe your phone completely to apply the resigned app updates. However, you will have to re-enter your google info and your call history and other minor things will be gone, but all of your apps will be retained.

Stericson

Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes