[Thunderbolt Q&A, Help & Troubleshooting] AndroidGraphix:
Noobs guide to theming

Credit:

tommytomatoe

For patiently walking me through the install/setup/how to process.

Glossary

How to PORT a theme to your ROM

Compiling APK's

How to make your compiled APK ready for a ZIP

How to install zipalign-Step by Step!

Running Zip Align in command prompt

If you've ever wanted to port a theme to your ROM or wanted to extract a clock or a MOD from one theme and move it over to your rom, then THIS THREAD IS FOR YOU!

What you'll need to download

1)7-ZIP http://www.7-zip.org/download.html

What this thread will not show you.

How to modify .9.png's. I have already made a thread just for .9.pngs located here:http://xdaforums.com/showthread.php?t=1140034

How to extract APK's from a theme based on your same ROM.

Once you've downloaded seven ZIP, download a theme that you would like to extract from and port it over to your rom. What I like to do is

make three folders. Label them: Original, Modified and Stripped.

Original Folder-Put the downloaded ZIP in this folder along with any APK's you extract from the "Stripped Folder."

Modified Folder-Also put a copy of the APK's you extract from the Stripped folder here. You'll be placing all png's in this folder, so DO NOT EVER extract these apk's.

Stripped Folder-This is the folder you'll extract apk's in their full form. You do this by right clicking on the mouse, then select "extract."

After you've placed the ZIP into the "stripped folder", you'll want to right click on the zip>7-ZIP> and select "extract to folder /*.*/"

Click through in the folder until you find all the apk's. Usually this path works: /system/app/

You've found the APK's...now what?

Now that you've found the apk's you should the most common apk's themed are:

HtcDialer.apk-htc_pin_asset_pressed.png,htc_pin_asset_rest.png are the phone buttons

Phone.apk-phone_default_incall_300.pngx4 are the android guy you see when calling, phone_end_pressed.9.png,phone_end_rest.9.png are the end call buttons

SystemUI.apk-status_bar_close_on.9.png-Status bar close, statusbar_background.png- the top notification bar that holds the clock and battery, status_bar_item_background_normal.9.png-is the background for the status bar notifications,

Fusion.apk-Need m10editor to mod but holds the 3d clock, home screen and lockscreen rosie

Idlescreen_base.apk-Need m10editor to mod but holds the icons you see on the lockscreen along with their background

Mms.apk-message_conversation_others.9.png,message_conversation_me.9.png the text message graphics that holds the text. "Conversation bubbles"

Rosie.apk-Holds the menu icons you see when you press, "Menu"

The two other main APk's are:

com.htc.resources.apk

framework-res.apk

Both are located in system/framework folder

FIND your graphics and PORT

It's fairly simple to open up an APK. Just right click on the APK>Select Extract File to:>

Then you'll be able to view all the png's in that APK. Click and drag them to another folder so you don't get them confused with other png's in that folder you won't be using.

Copy all the png's you would like to port in their own folder. Here's an example of my personal setup for keeping track of PNG's and what folder they go into. Pretty simple.

Transferring the PNG's back into the APK that corresponds to your ROM.

You should now have organized all the PNG's you want in their folders and are ready to transfer these png's into an APK.

You should now download the EXACT ROM or THEME that you are on and extract the APK's for that theme. You do NOT need all of theme. You only need the ones you've modified. I put these APK's in the MODAPK folder.

Then right click on the APK you would like to transfer the png's to. Right click>7-Zip>Open Archive. Then click through until you get to the drawable-hdpi folder. Or the same folder you acquired the png's from the other apk.

This is what your screen should look like once you've right clicked on an APK> Selected 7-ZIP>Open Archive, you should see the following:

DRAG your PNG's into drawable-hdpi

Now, you'll want to select all the images that need to be ported and drag them into the drawable-hdpi folder.

You're 90% done. Copy these APK's to a zip and flash! If you do not know how to create a zip, find a theme that is based on your ROM. Do the same steps to open archive via 7-ZIP. Then delete whatever Apk's are in that ZIP that you're not going to use. (NOTE: You should leave at least one apk in the folder otherwise the folder will collapse.) Then just transfer your APK's into the zip. Make sure you transfer ONLY APK's that haven't been extracted!

Setting up APKTools & Decompiling APK's

This could have been started in another thread, but it goes hand in hand with theming. When you know how to decompile an APK you can edit the XML.

There are many reason why someone would want to edit XML. One example is to INVERT MMS. This is done by editing the XML within the Mms.apk.

I had a very difficult time setting this up but thanks to tommytomatoe he gave me a no brainer step by step guide to setting up apktools.

Requirements:

Download ApkTools here>>APKTOOLS

-tommytomatoe

Items to note about the above process:

1)You must use the framework-res.apk and com.htc.resources.apk from YOUR ROM. It contains "coding" for lack of a better word that apktools uses to encrypt..I guess, the apk's.

Other greats links that will help you Decompile apk's

http://xdaforums.com/showthread.php?t=1133485

How to install APK Manager

I've started to use APKManager for Compiling APK's and also had trouble installing/setting up. Here's my how to guide to getting it done.

Download APK Manager here>>APKMANAGER

1)Once downloaded, unpack/unzip and place the apk_manager_4.9 in the same directory your ADB is located. Specifically, adb.exe. My directory is as follows:

C:\android-sdk-windows\platform-tools\apk_manager_4.9

If you don't have it installed in this directory, you will won't be able to compile Apk's.

Compiling APK's

After you decompile an APK for whatever reason such as editing an XML, you'll eventually need to compile it.

Open RUN

by holding down the windows button and "R" then enter in cmd

The fastest way to get to your *.*.apk is to highlight and copy the explorer bar address,

then go into command prompt type:

cd

After cd, hit space, then right click on your mouse and paste.

You should now be in the directory of your APK.

Just to recap, to Decompile an apk, type

apktool d *.*.apk

in the command prompt. (Pictured Below)

You'll then see your decompiled apk folder. In this example, it's SystemUI

Compiling Command-Apktool

To compile the apk, go into command and type:

apktool b *.*.apk In this example, I'm using SystemUI.apk so...

apktool b SystemUI

Inside the decompiled SystemUI.apk folder you'll see a newly created folder called, "build" and "dist" (Pictured Below)

The dist folder contains your compiled apk that just needs signatures(META-INF) and zipalign to be ready. The build folder contains the compiled apk in a folder format. If you're just modifying a couple xml's then you can copy them from the build/apk/res/*.* and paste them into your apk using 7-zip. Just know, the values folder you see when the apk is decompiled will not be shown and many other folders may not be available as well. This is when you're going to have to use the apk from dist folder.

How to make your compiled APK ready

The compiled apk is found in the dist folder. You can't use it yet, because it needs the original META-INF folder(signatures) and AndroidManifest.xml.

The fastest way to get these is to go back to your apk. In this example, we'll use SystemUI.apk. More than likely the apk you're using has already been decompiled in the same directory. To prevent and over-write, put the apk in it's own directory and extract it. (Pictured below)

You should see the META-INF folder and AndroidManifest.xml in the apk you just extracted. (Pictured below)

I recommend you copy these to the dist folder containing your apk. You'll be dragging these into that apk using 7-zip. To do this, right click on the apk and select, "Open Archive", then drag your META-INF folder and AndroidManifest.xml into the open dialogue box. (Pictured Below)

Congrats! Your apk is now signed BUT IS NOT READY until zipaligned.

How to install zipalign

What you'll need first

Android-sdk located here>> http://developer.android.com/sdk/index.html

ZIPalign reference Article tutorial information.

Once you've installed Android-SDK, go into the tools folder. My directory path is: C:\Program Files\Android\android-sdk\tools You're could be different.

What we're going to do is make it where you can use zipalign in any directory along with draw9patch while where there.

In the tools folder, copy zipalign.exe and draw9patch.bat. Place it in the c:\windows directory. NOTE: Any executable files you place in this folder you'll be able to access anywhere while running cmd prompt.

Running zipalign in command prompt

Now that you've installed zipalign in c:\windows we can access it from anywhere. Let's give it a test.

Go to your res folder which contains the newly signed apk in command prompt.Then type:

zipalign -fv 4 SystemUI.apk SystemUI-new.apk

After running you should have a new apk named: SystemUI-new.apk seen in my example below.

Congrats again. You now have a signed apk and have run it through zipalign. It's now ....finally ready to be put back into a zip file for flash or pushed via adb.