# [Guide] How to port themes to T-Mobile Theme Chooser



## Kwes1020

OK I and a lot of others have gotten requests to port themes for people. So I decided to make a quick guide of how to port your own themes yourself. This is not intended to teach you how to theme. You must have some basic knowledge of how to use apktool and edit xml. If you don't know how to do that this might not be much use to you. This works for gb and ics theme Chooser.

Tools needed and a brief description of them:
Gimp or Photoshop (to edit images of course)
Notepad++ for windows users or gedit for Linux users. (This is for editing XML)
Apktool, or any apk editor of your choice (to compile and decompile the apk files of course)
Fast Stone Image Viewer ( this is a very handy tool. I use it for batch renaming and batch conversion of indexed images)
A theme Chooser template. I usually use androidian.apk
Your theme you want to port. Preferably a gingerbread or ICS theme
Another awesome tool is the cm9 xml tool by DcoMbl the tool is located HERE be sure to thank him!
I myself use Virtuous Ten Studio. This eliminates the need for a text editor, apktool, adb and many other things since it has it all built in. I highly recommend trying it if you haven't already.

*Brief Description of how the theme chooser works.*

Alright, I will do my best to describe this so everyone can follow along and possibly understand. Basically how the theme chooser works is it uses redirection xml files to overlay images over existing images in applications on your device. This is why a lot of the things have to be exact.

Example
Say you have a battery image which in its natural state inside its usual SystemUI.apk app. This image will be named *stat_sys_battery_100* this is what the redirect xml inside your theme .apk will look for to replace. The code in your com_android_systemui.xml to make your theme replace this image will look like this.



Code:


<br />
<item name="drawable/stat_sys_battery_100">@drawable/com_android_systemui_stat_sys_battery_100</item><br />

Where it says *<item name="drawable/stat_sys_battery_100">* is the image your theme app is looking for inside the SystemUI.apk. It is going to overlay that image with your image in your theme named *com_android_systemui_stat_sys_battery_100*

Every image in your theme has to be directed what to overlay in the apps you are trying to add to your theme.apk

When you are adding new apps to theme in your theme chooser apk you get the name you need to use out of their AndroidManifest.xml you want to use the package name but instead of using *.* you will replace that with *_* so if you decompile SystemUI you will see in the manifest it says package name= com.android.systemui so you will name your redirect xml that is located in your xml folder com_android_systemui.xml

The tool by decomobile will do this automatically for you but sometimes it adds extra characters to the very beginning of the xml so you need to delete that and retype it in.
I hope that wasn't too complex of an explanation...

**How to port themes from flashable themes.**

K let's get down to business.
First, decompile your theme chooser template.
Go into your template find androidmanifest.XML and open it.
Inside of androidmanifest you will see title author and things like that. Change them to what you want.
Next go into your values folders. Look through the XML files there and search for the original author name and app title. Change them to exactly what you changed in androidmanifest. Exactly means capitalization too. If I recall correctly styles and strings are the main 2 XML that need changing.
Now compile the apk and test it. If it works correctly then you're good to proceed.
Now decompile framework-res.apk and systemui.apk of the theme you're porting from.
After you decompile look in your templates drawable/drawablehdpi folders find the name for the files referring to frameworkres it should be frameworks_res_xxxxxx.PNG xxxxxx representing an image name. Search for systemui as well should be something like com_android_systemui_xxxxx.png.

Open fast stone image viewer. Navigate to your decompiled framework Res. Select all the image files in your drawable folders. Go to tools in the title bar of fast stone and select batch rename. In the grey drop down under where it displays the image names type frameworks_res_* the star represents keep the original image name. And hit convert. It will rename them all. Do this for all the drawable folders.
Next you will do the same thing for systemui drawable folders but instead use com_android_systemui_* or whatever is used in your template.

Now simply replace the images in the theme template with your images.
**Do not add extra images unless you add them to the appropriate XML files too. It will cause errors. So at first I would only replace images so you can get the best chance of a clean build.**
Once you get frameworkres and systemui ported recompile and test it. If it works you can move on to edit XML colors and adding all the other app files you wish.
***there are many guides on adding content to theme chooser. Just Google it if you wish to add/remove content. I will not be going on about how to do that because its already well documented.***

Always use your own original content for your themes do not steal from others.

*Advanced Techniques *
***Coming SOON***

Here I will discuss some more advanced techniques, such as adding you're own new content and images.


----------



## superstargoddess

Let me get this straight before I kill myself trying to learn how to do all of this:

I could use this tutorial to port any CM7 Theme Chooser theme to CM9 version Theme Chooser?

I've always wanted to get into theming but haven't got around to figuring it out yet. Though I would say that porting old themes to the new Theme Chooser would probably be a good start for learning.


----------



## Kwes1020

No. This is for porting flashable themes. However porting cm7 to cm9 should just be replacing images for the most part, but you will have to make your own holo images since gingerbread doesn't use holo. If you're doing them for personal use it should be OK. But if you're porting someone else's work for distribution its always a good idea to ask the creator first.


----------



## cowsquad

Great tutorial or guide.Thank you so much.


----------



## JBowdacious

Awesome man. Thanks!


----------



## theduce102

Where are the compiled apks stored using Virtuous Ten Studio? I can't find them anywhere lol


----------



## Kwes1020

theduce102 said:


> Where are the compiled apks stored using Virtuous Ten Studio? I can't find them anywhere lol


Mine go to documents>virtuous ten studio>projects then inside the binary folder. Your decompiled apps go to projects/data. Or you can just click binary from the home menu of virtuous and it will bring you there.


----------



## theduce102

Kwes1020 said:


> First, decompile your theme chooser template.
> Go into your template find androidmanifest.XML and open it.
> Inside of androidmanifest you will see title author and things like that. Change them to what you want.
> Next go into your values folders. Look through the XML files there and search for the original author name and app title. Change them to exactly what you changed in androidmanifest. Exactly means capitalization too. If I recall correctly styles and strings are the main 2 XML that need changing.
> Now compile the apk and test it. If it works correctly then you're good to proceed.


After I do the steps above, when I try to install the apk, it says "Application not installed". I didn't do anything else in the apk other than rename what I was supposed to. I used the stock Androidian.apk and everything built properly [without errors]. I am having the hardest time trying to get my theme working =/


----------



## mbh87

theduce102 said:


> After I do the steps above, when I try to install the apk, it says "Application not installed". I didn't do anything else in the apk other than rename what I was supposed to. I used the stock Androidian.apk and everything built properly [without errors]. I am having the hardest time trying to get my theme working =/


did you sign the apk? if not then do so and try again.


----------



## theduce102

mbh87 said:


> did you sign the apk? if not then do so and try again.


I'm a dodo lol thanks.

Edit: The apk installs but now when I try to apply the theme it says, "This theme was improperly compiled and cannot be applied. Please report this incident to the theme author."

Sent from my cm_tenderloin using Tapatalk 2


----------



## mbh87

theduce102 said:


> I'm a dodo lol thanks.
> 
> Edit: The apk installs but now when I try to apply the theme it says, "This theme was improperly compiled and cannot be applied. Please report this incident to the theme author."
> 
> Sent from my cm_tenderloin using Tapatalk 2


if you have another theme selected other than system default selected then you need to go back to default and reboot, then apply the new theme.


----------



## theduce102

mbh87 said:


> if you have another theme selected other than system default selected then you need to go back to default and reboot, then apply the new theme.


System default was on, rebooted, same theme error... =/ could it be that Virtuous Ten isn't doing something right?

Sent from my cm_tenderloin using Tapatalk 2


----------



## mbh87

theduce102 said:


> System default was on, rebooted, same theme error... =/ could it be that Virtuous Ten isn't doing something right?
> 
> Sent from my cm_tenderloin using Tapatalk 2


What device are you trying to use it on? It worked before you modded it?

You may also want to look at this thread. http://forum.xda-developers.com/showthread.php?t=964391


----------



## theduce102

mbh87 said:


> What device are you trying to use it on? It worked before you modded it?
> 
> You may also want to look at this thread. http://forum.xda-developers.com/showthread.php?t=964391


Samsung Epic 4G (SPH-D700) and yeah the original androidian theme would apply without a problem. In the one I modded, all I changed was the name of the app and the author. I don't understand why it's being such a pain lol

Sent from my cm_tenderloin using Tapatalk 2


----------



## Kwes1020

Did you change the info in styles and strings also? I get that error sometimes too. It seems to happen to a lot of people randomly. If nothing else send me the apk in a pm and I will look at it.


----------



## theduce102

Kwes1020 said:


> Did you change the info in styles and strings also? I get that error sometimes too. It seems to happen to a lot of people randomly. If nothing else send me the apk in a pm and I will look at it.


Yep, did the style and strings too. I'll upload it and send it to you tomorrow  thanks man.

Sent from my cm_tenderloin using Tapatalk 2


----------



## frankydroid

Is it possible to create a apk that only changes a handful of icons and one xml that's in systemui? woods that require anything special? Also, if I apply that theme described AFTER installing a full theme, will it keep the previous theme except for what I changed? It worked like that in cm7 so I assume it will now too


----------



## Kwes1020

frankydroid said:


> Is it possible to create a apk that only changes a handful of icons and one xml that's in systemui? woods that require anything special? Also, if I apply that theme described AFTER installing a full theme, will it keep the previous theme except for what I changed? It worked like that in cm7 so I assume it will now too


Yes that's possible you would have to make redirects if the items you add are not in your template.. No themes can't overlay each other.


----------



## Kwes1020

I will be updating this post sometimes within the next week to give even more info about making themes.

Sent from my Galaxy Nexus using RootzWiki


----------



## Smokem_I

Kwes1020 said:


> I will be updating this post sometimes within the next week to give even more info about making themes.
> 
> Sent from my Galaxy Nexus using RootzWiki


Thanks for the great list of tools! I've been making themes for theme chooser for a while and these tools will help tremendously! Thanks again and keep up the great work!

Sent from my US HTC One S using Tapatalk 2


----------



## frankydroid

Hmmm, i just modified and successfully compiled my theme apk and signed it, but it wouldnt install. Could anyone take a look at it for me?


----------



## jellybellys

frankydroid said:


> Hmmm, i just modified and successfully compiled my theme apk and signed it, but it wouldnt install. Could anyone take a look at it for me?


What's the error when installing from ADB?


----------



## frankydroid

jellybellys said:


> What's the error when installing from ADB?


I never tried adb. I'll try it out soon

Sent from my Galaxy Nexus using Tapatalk 2


----------



## frankydroid

Okay, here is what I receive:


Code:


<br />
<br />
<br />
[URL=xxxx-xxxx-MacBook-Pro:Downloads]xxxx-xxxx-MacBook-Pro:Downloads[/URL] xxxx$ adb install /Users/xxxx/Desktop/weathermodWIP-signed.apk<br />
2583 KB/s (939510 bytes in 0.355s)<br />
pkg: /data/local/tmp/weathermodWIP-signed.apk<br />
Failure [INSTALL_FAILED_DEXOPT]<br />
<br />
<br />

I looked at the logcat and found this:



Code:


<br />
<br />
D/AndroidRuntime( 2294): Calling main entry com.android.commands.pm.Pm<br />
I/ActivityManager(  637): Start proc com.android.defcontainer for service com.android.defcontainer/.DefaultContainerService: pid=2304 uid=10011 gids={1015, 2001}<br />
W/ActivityManager(  637): No content provider found for permission revoke: [URL=file:///data/local/tmp/weathermodWIP-signed]file:///data/local/tmp/weathermodWIP-signed[/URL].apk<br />
W/ActivityManager(  637): No content provider found for permission revoke: [URL=file:///data/local/tmp/weathermodWIP-signed]file:///data/local/tmp/weathermodWIP-signed[/URL].apk<br />
I/PackageManager(  637): Running dexopt on: com.tmobile.theme.Franky<br />
W/dalvikvm( 2318): DexOptZ: zip archive '/data/app/com.tmobile.theme.Franky-1.apk' does not include classes.dex<br />
W/installd(  124): DexInv: --- END '/data/app/com.tmobile.theme.Franky-1.apk' --- status=0xff00, process failed<br />
E/installd(  124): dexopt failed on '/data/dalvik-cache/[email protected]@[email protected]' res = 65280<br />
W/PackageManager(  637): Package couldn't be installed in /data/app/com.tmobile.theme.Franky-1.apk<br />
D/dalvikvm(  637): GC_EXPLICIT freed 1234K, 30% free 9536K/13443K, paused 3ms+8ms<br />
D/AndroidRuntime( 2294): Shutting down VM<br />
<br />
<br />

I'm new to the creation and editing of anything other than images within an apk. I might have simply made a beginner mistake. I've done some searching but I'm not sure what to do about the no classes.dex

Thanks in advance


----------



## frankydroid

frankydroid said:


> Okay, here is what I receive:
> 
> 
> Code:
> 
> 
> <br />
> <br />
> <br />
> [URL=xxxx-xxxx-MacBook-Pro:Downloads]xxxx-xxxx-MacBook-Pro:Downloads[/URL] xxxx$ adb install /Users/xxxx/Desktop/weathermodWIP-signed.apk<br />
> 2583 KB/s (939510 bytes in 0.355s)<br />
> pkg: /data/local/tmp/weathermodWIP-signed.apk<br />
> Failure [INSTALL_FAILED_DEXOPT]<br />
> <br />
> <br />
> 
> I looked at the logcat and found this:
> 
> 
> 
> Code:
> 
> 
> <br />
> <br />
> D/AndroidRuntime( 2294): Calling main entry com.android.commands.pm.Pm<br />
> I/ActivityManager(  637): Start proc com.android.defcontainer for service com.android.defcontainer/.DefaultContainerService: pid=2304 uid=10011 gids={1015, 2001}<br />
> W/ActivityManager(  637): No content provider found for permission revoke: [URL=file:///data/local/tmp/weathermodWIP-signed]file:///data/local/tmp/weathermodWIP-signed[/URL].apk<br />
> W/ActivityManager(  637): No content provider found for permission revoke: [URL=file:///data/local/tmp/weathermodWIP-signed]file:///data/local/tmp/weathermodWIP-signed[/URL].apk<br />
> I/PackageManager(  637): Running dexopt on: com.tmobile.theme.Franky<br />
> W/dalvikvm( 2318): DexOptZ: zip archive '/data/app/com.tmobile.theme.Franky-1.apk' does not include classes.dex<br />
> W/installd(  124): DexInv: --- END '/data/app/com.tmobile.theme.Franky-1.apk' --- status=0xff00, process failed<br />
> E/installd(  124): dexopt failed on '/data/dalvik-cache/[email protected]@[email protected]' res = 65280<br />
> W/PackageManager(  637): Package couldn't be installed in /data/app/com.tmobile.theme.Franky-1.apk<br />
> D/dalvikvm(  637): GC_EXPLICIT freed 1234K, 30% free 9536K/13443K, paused 3ms+8ms<br />
> D/AndroidRuntime( 2294): Shutting down VM<br />
> <br />
> <br />
> 
> I'm new to the creation and editing of anything other than images within an apk. I might have simply made a beginner mistake. I've done some searching but I'm not sure what to do about the no classes.dex
> 
> Thanks in advance


I extracted some themes that work and they don't have a classes.dex , so I'm at a loss for what to do :-l but I'll keep looking

Sent from my Galaxy Nexus using Tapatalk 2


----------



## Kwes1020

frankydroid said:


> I extracted some themes that work and they don't have a classes.dex , so I'm at a loss for what to do :-l but I'll keep looking
> 
> Sent from my Galaxy Nexus using Tapatalk 2


Classes.dex builds upon compilation from the smali files.

Sent from my Galaxy Nexus using RootzWiki


----------



## krazie1

Okay i am stuck at the part that says replace images. What images do i replace, im using the androidian as a template and there are only 6 drawable folders but the theme i want to port has 8 drawable in framework and 5 drawable in systemui.Which images do i replace and how would i go about replacing the? Also im using Virtuous Ten Studio as you suggested Kwes1020


----------



## Kwes1020

krazie1 said:


> Okay i am stuck at the part that says replace images. What images do i replace, im using the androidian as a template and there are only 6 drawable folders but the theme i want to port has 8 drawable in framework and 5 drawable in systemui.Which images do i replace and how would i go about replacing the? Also im using Virtuous Ten Studio as you suggested Kwes1020


 xhdpi to xhdpi. Hdpi to hdpi. Those are where the majority of system app images will be. Batch rename them as I described. Then replace the ones in the template with what you're porting.

Sent from my Galaxy Nexus using RootzWiki


----------



## krazie1

Kwes1020 said:


> xhdpi to xhdpi. Hdpi to hdpi. Those are where the majority of system app images will be. Batch rename them as I described. Then replace the ones in the template with what you're porting.
> 
> Sent from my Galaxy Nexus using RootzWiki


Ok im using the androidian template you suggested and it has no drawable xhdpi, does it matter? And does the galaxy nexus use hdpi or xhdpi? Thanks.


----------



## Kwes1020

krazie1 said:


> Ok im using the androidian template you suggested and it has no drawable xhdpi, does it matter? And does the galaxy nexus use hdpi or xhdpi? Thanks.


Well in all honesty you can use either theme chooser adjusts scale for most images.

Galaxy nexus is xhdpi. But hdpi themes work too
Sent from my Galaxy Nexus using RootzWiki


----------



## krazie1

Kwes1020 said:


> Well in all honesty you can use either theme chooser adjusts scale for most images.
> 
> Galaxy nexus is xhdpi. But hdpi themes work too
> Sent from my Galaxy Nexus using RootzWiki


Ok and last question (sorry for all these questions) I added images from the xhdpi folder to the hdpi folder of the androidian template and my data signal bars are big when connected to google but when there grey they are normal size, do i have to resize the images or did i do something wrong?


----------



## Kwes1020

krazie1 said:


> Ok and last question (sorry for all these questions) I added images from the xhdpi folder to the hdpi folder of the androidian template and my data signal bars are big when connected to google but when there grey they are normal size, do i have to resize the images or did i do something wrong?


Sounds like you didn't add the same size images for signal fully and connected. For example you only added the fully from xhdpi but didn't add the connected ones.

Sent from my Galaxy Nexus using RootzWiki


----------



## frankydroid

Kwes1020 said:


> Classes.dex builds upon compilation from the smali files.
> 
> Sent from my Galaxy Nexus using RootzWiki


Any idea why my recompiled androidian apk wouldn't compile with a classes.dex?

I never adjusted anything inside the smali folder...

Sent from my Galaxy Nexus using Tapatalk 2


----------



## Kwes1020

frankydroid said:


> Any idea why my recompiled androidian apk wouldn't compile with a classes.dex?
> 
> I never adjusted anything inside the smali folder...
> 
> Sent from my Galaxy Nexus using Tapatalk 2


Does it actually fully build? Have you tried simply decompile and compile androidian without edits to see if it works?

Sent from my Galaxy Nexus using RootzWiki


----------



## frankydroid

Kwes1020 said:


> Does it actually fully build? Have you tried simply decompile and compile androidian without edits to see if it works?
> 
> Sent from my Galaxy Nexus using RootzWiki


It compiles with no errors reported, I was surprised. I'll recompile with no edits to see how it goes. Thanks, that's a good idea

Sent from my Galaxy Nexus using Tapatalk 2


----------



## Skilover

There is something messed up in the Theme Manager App included with APOK/CM9. Especially on my Tab 10.1, it provides the "theme won't compile" error at the drop of a hat. I have one theme that loaded the first time, directly from another them, and then was updated by the market. Now, it won't load, producing the "theme won't compile error". This is the SAME theme the loaded fine the first time, with a few updates. It's very, very touchy. On my Nexus, I find it to be more stable.

I've found very few themes seem to load on the Tab. I was originally told they need MDPI elements. However, I loaded a theme the other day fine, and the developer told me it has no MDPI elements at all. I hope this gets improved soon--I do realize it's all new.


----------



## Kwes1020

Skilover said:


> There is something messed up in the Theme Manager App included with APOK/CM9. Especially on my Tab 10.1, it provides the "theme won't compile" error at the drop of a hat. I have one theme that loaded the first time, directly from another them, and then was updated by the market. Now, it won't load, producing the "theme won't compile error". This is the SAME theme the loaded fine the first time, with a few updates. It's very, very touchy. On my Nexus, I find it to be more stable.
> 
> I've found very few themes seem to load on the Tab. I was originally told they need MDPI elements. However, I loaded a theme the other day fine, and the developer told me it has no MDPI elements at all. I hope this gets improved soon--I do realize it's all new.


Yeah alot of people are having issues with tablets and theme chooser. I myself dont have a tablet so i cant really test for fixes. If you are referring to the improperly compiled error just apply system reboot then apply the theme and reboot. Also i noticed its a little less buggy if you use a different theme while updating.

Sent from my Galaxy Nexus using Tapatalk 2


----------



## XperianceD

Kwes1020 said:


> A theme Chooser template. I usually use androidian.apk


So it's that simple, I don't actually need to use the theme engine or eclipse?


----------



## Kwes1020

XperianceD said:


> So it's that simple, I don't actually need to use the theme engine or eclipse?


Your rom has to support the T-Mobile theme chooser. But no you don't have to use eclipse.
Sent from my Galaxy Nexus using Tapatalk 2


----------



## XperianceD

Kwes1020 said:


> But no you don't have to use eclipse.


That's good to know as I've looked towards using it before but it seems something like that is way above my skill set. I installed Virtuous last night and had a tinker, what a tool, that's gonna save some time so thanks a lot for that tip, although after modding my Contacts.apk,building and pushing the changes haven't set, but I'll have a proper play with it at the weekend


----------



## drt054

Thanks for the tips!! Androidian.apk is only in CM7 I believe.. Does CM9 have a similar template? I couln't see anything obvious in /system/app..

Nevermind.. found one here.. Thx!!

http://forum.xda-developers.com/showthread.php?t=1798350


----------



## A_Shogun_Named_Marcus

I know you mention in the OP that there are lots of guides on adding content to themes but I can't find anything that's of great help... Could you maybe point me in the right direction?? I have a theme decompiled replaced what was available and recompiled no problem, but when I add extra images or folders like "color" and "anim" I get errors... Is there an XML compiler or something I can use to add the extras?? I know you need to modify the xmls to match but so far doing it manually is getting me nowhere.

Can you please help?


----------



## Kwes1020

A_Shogun_Named_Marcus said:


> I know you mention in the OP that there are lots of guides on adding content to themes but I can't find anything that's of great help... Could you maybe point me in the right direction?? I have a theme decompiled replaced what was available and recompiled no problem, but when I add extra images or folders like "color" and "anim" I get errors... Is there an XML compiler or something I can use to add the extras?? I know you need to modify the xmls to match but so far doing it manually is getting me nowhere.
> 
> Can you please help?


Sorry I forgot this thread was here guess I can update it with more info while im here.

I wouldnt try to add anything from the anim folder. As for the colors I usually add them to the colors.xml. It all really depends on what you are trying to achieve. If you are adding things from the color folder itself you have to have your redirects call on those for what specific app they are used for. I would decompile a template to use as a guide, if you are unsure of what exactly to do.


----------

