5,600,919 Members 42,938 Now Online
XDA Developers Android and Mobile Development Forum

[TUTORIAL] How to easily THEMES .apk (for DEODEXED ROM only)

Tip us?
 
Andrewtst
Old
(Last edited by Andrewtst; 14th April 2012 at 03:49 PM.)
#1  
Andrewtst's Avatar
Senior Member - OP
Thanks Meter 1255
Posts: 3,945
Join Date: Aug 2009
Location: Johor

 
DONATE TO ME
Default [TUTORIAL] How to easily THEMES .apk (for DEODEXED ROM only)

After few days surfing, asking & testing. I decide to make a easily tutorial for theming in Windows, I think as long you know to use computer, they is nothing much difficult to theming/modifying the .apk yourself.

My guide only cover:
  • De-compile & compile of .apk
  • changing the .png file inside .apk
  • Modifying tricky .9.png file.
  • Modifying .xml file.
  • Zip Align the .apk

What you need:
  • Your phone must be ROOT and DEODEXED.
  • CWM pre-install recommended, you can simply get this function by installing superatmos / Lucifr kernel.
  • 7-zip - for replacing file inside .apk
  • JRE (Java Runtime Environment) - required to run the APKtool
  • Android-SDK - must install before APKtool & Zipalign work.
  • APKTool Download the apktool & also apktool-install-windows.

Before Start:
  • Always remember make a backup for any .apk file you plan to change or amend.
  • Recommended make a flash-able version of origin not amend .apk in-case something went wrong, you can always flash back the original file via CWM. Example if you did something wrong in your systemUI.apk (for statusbar) it will probably make your phone nearly impossible access any part due to unstop FC.
I also like to take this opportunity to THANKS the following user help, without them, all this is not possible.
  • ronhoover88
  • superatmos
  • tarunagg
  • Vertumus
Phone: Samsung Galaxy Note 3 | | Kernel: Stock | ROM: X-Note 13.0 v4.4.2 KitKat - XXUENC2
Future Phone: Sony Xperia Z2

Ex. Phone: Nokia 3310, Samsung S500, Nokia 7610, 7270, 7280, SE K750, Nokia N73, LG Viewty KU990, Samsung Pixon, UltraTOUCH, OMNIA II, Nokia 3120 Classic, Google Nexus One, Samsung Galaxy S II, S III, Sony Xperia Z, Z Ultra

Tablet: Sony Xperia Tablet Z | ROM: v4.3 - 10.4.B.0.577
Future Tablet: Still Finding

Ex. Tablet: Google Nexus 10
The Following 19 Users Say Thank You to Andrewtst For This Useful Post: [ Click to Expand ]
 
Andrewtst
Old
(Last edited by Andrewtst; 18th April 2012 at 08:21 AM.)
#2  
Andrewtst's Avatar
Senior Member - OP
Thanks Meter 1255
Posts: 3,945
Join Date: Aug 2009
Location: Johor

 
DONATE TO ME
De-compile & Compile of .apk

Why this step is required:
  • You need to de-compile the .apk before you can correctly modified the tricky .9.png and also to see a readable .xml for amending.
Step:
  • Install JRE (Java Runtime Environment) & Android-SDK.
  • Download the apktool & also apktool-install-windows, extract the file and put inside your Windows Folder.
  • Open command prompt (Start - Run - CMD)
  • Before de-compile the .apk, make sure you copy out your current phone framework-res.apk & twframework-res.apk, lidroid-res.apk only required if you using lidroid-res.apk in your framework.
    Code:
    apktool if [location of .apk]
    
    Example:
    apktool if D:\APK\framework-res.apk
    apktool if D:\APK\twframework-res.apk
    apktool if D:\APK\lidroid-res.apk
  • Now, De-compile the .apk
    Code:
    apktool d [filename.apk] [directory]
    
    Example: apktool d D:\framework-res.apk D:\De-compile
  • If sucess, you will seen the following line in your CMD.
  • The De-compile folder will be generate as seen below.
  • Now you can amend whatever you like to amend, after done, proceed to following step.
  • Compile back:
    Code:
    apktool b [directory]
    
    Example: apktool b D:\De-compile
  • Extra build folder will appear inside your De-compile folder, all file inside here already compile and can use later in your Android phone.
Phone: Samsung Galaxy Note 3 | | Kernel: Stock | ROM: X-Note 13.0 v4.4.2 KitKat - XXUENC2
Future Phone: Sony Xperia Z2

Ex. Phone: Nokia 3310, Samsung S500, Nokia 7610, 7270, 7280, SE K750, Nokia N73, LG Viewty KU990, Samsung Pixon, UltraTOUCH, OMNIA II, Nokia 3120 Classic, Google Nexus One, Samsung Galaxy S II, S III, Sony Xperia Z, Z Ultra

Tablet: Sony Xperia Tablet Z | ROM: v4.3 - 10.4.B.0.577
Future Tablet: Still Finding

Ex. Tablet: Google Nexus 10
The Following 6 Users Say Thank You to Andrewtst For This Useful Post: [ Click to Expand ]
 
Andrewtst
Old
(Last edited by Andrewtst; 14th April 2012 at 08:29 AM.)
#3  
Andrewtst's Avatar
Senior Member - OP
Thanks Meter 1255
Posts: 3,945
Join Date: Aug 2009
Location: Johor

 
DONATE TO ME
Changing/Replacing the .png file inside .apk
  • Amending normal .png no need to de-compile, just extract the file and modified using any photoshop tools or simply replace the .png
  • Just right click any .apk file and select 7-zip extract to, as seen below:
  • Now go to the extracted folder and amend / replace any .png file you like to replace. (Remember .9.png file cannot just simply replace, check following post for instruction.)
Phone: Samsung Galaxy Note 3 | | Kernel: Stock | ROM: X-Note 13.0 v4.4.2 KitKat - XXUENC2
Future Phone: Sony Xperia Z2

Ex. Phone: Nokia 3310, Samsung S500, Nokia 7610, 7270, 7280, SE K750, Nokia N73, LG Viewty KU990, Samsung Pixon, UltraTOUCH, OMNIA II, Nokia 3120 Classic, Google Nexus One, Samsung Galaxy S II, S III, Sony Xperia Z, Z Ultra

Tablet: Sony Xperia Tablet Z | ROM: v4.3 - 10.4.B.0.577
Future Tablet: Still Finding

Ex. Tablet: Google Nexus 10
The Following 6 Users Say Thank You to Andrewtst For This Useful Post: [ Click to Expand ]
 
Andrewtst
Old
(Last edited by Andrewtst; 14th April 2012 at 10:50 AM.)
#4  
Andrewtst's Avatar
Senior Member - OP
Thanks Meter 1255
Posts: 3,945
Join Date: Aug 2009
Location: Johor

 
DONATE TO ME
Modifying tricky .9.png file.
  • The .9.png cannot just simply amend using any photoshop and put back, because by doing so, either the amend .9.png won't appear or just simply give you FC in your phone when running it.

What to do:
  • De-compile the .apk.
  • Below showing the different between before and after de-compile of .9.png, as you can seen on right image,they is extra 4 black dot + 1 black bar and surrouding with transparent bar, all this area must be keep and not amend during photoshop. The de-compile image will auto increase 1 x pixel + 1 y Pixel.
  • Just amend without touching those area, save it and then put back to correct folder and compile back.
Phone: Samsung Galaxy Note 3 | | Kernel: Stock | ROM: X-Note 13.0 v4.4.2 KitKat - XXUENC2
Future Phone: Sony Xperia Z2

Ex. Phone: Nokia 3310, Samsung S500, Nokia 7610, 7270, 7280, SE K750, Nokia N73, LG Viewty KU990, Samsung Pixon, UltraTOUCH, OMNIA II, Nokia 3120 Classic, Google Nexus One, Samsung Galaxy S II, S III, Sony Xperia Z, Z Ultra

Tablet: Sony Xperia Tablet Z | ROM: v4.3 - 10.4.B.0.577
Future Tablet: Still Finding

Ex. Tablet: Google Nexus 10
The Following 6 Users Say Thank You to Andrewtst For This Useful Post: [ Click to Expand ]
 
Andrewtst
Old
(Last edited by Andrewtst; 14th April 2012 at 07:57 PM.)
#5  
Andrewtst's Avatar
Senior Member - OP
Thanks Meter 1255
Posts: 3,945
Join Date: Aug 2009
Location: Johor

 
DONATE TO ME
Modifying .xml file
  • After you have de-compile the .apk, now all inside .xml is readable where you can make some changes on the color selection, clock position and etc. by just simply open with notepad and modified.
  • Before de-compile, the .xml look like below which is not readable and understand by human.
  • After de-compile, now the .xml is readable and understand by human.
  • Now you can amend what ever you like, Google/Search XDA forum for which .XML to amend.
  • Use this color code checker site for getting your desire color code.
  • After done, don't forget, you must compile back the .xml before it is understandable by Android OS.
  • Screenshot below showing modifying the sub text .xml to ICS blue color.


    Change all
    Code:
    from android:color="#ffffffff to android:color="#ff3f9bbf
    at zzz_tw_secondary_text_sub.xml
Phone: Samsung Galaxy Note 3 | | Kernel: Stock | ROM: X-Note 13.0 v4.4.2 KitKat - XXUENC2
Future Phone: Sony Xperia Z2

Ex. Phone: Nokia 3310, Samsung S500, Nokia 7610, 7270, 7280, SE K750, Nokia N73, LG Viewty KU990, Samsung Pixon, UltraTOUCH, OMNIA II, Nokia 3120 Classic, Google Nexus One, Samsung Galaxy S II, S III, Sony Xperia Z, Z Ultra

Tablet: Sony Xperia Tablet Z | ROM: v4.3 - 10.4.B.0.577
Future Tablet: Still Finding

Ex. Tablet: Google Nexus 10
The Following 6 Users Say Thank You to Andrewtst For This Useful Post: [ Click to Expand ]
 
Andrewtst
Old
(Last edited by Andrewtst; 18th April 2012 at 10:23 AM.)
#6  
Andrewtst's Avatar
Senior Member - OP
Thanks Meter 1255
Posts: 3,945
Join Date: Aug 2009
Location: Johor

 
DONATE TO ME
Zipalign the .apk

Why this step is required:
  • You need to align the .apk to let the Android phone run the modified .apk perform much smoother and better, if you have more not align .apk file in your phone, it will eventually drag down your entire phone performance.
  • This step is not necessary but recommended.

Step:
  • Open command prompt at your Android-SDK Tools folder
  • Type following command and run
    Code:
    zipalign -fv 4 [filename.apk] [filename-new.apk]
    
    Example: zipalign -fv 4 framework-res.apk framework-res-new.apk
  • A new Zipalign .apk will be generate as seen below, highlight in blue.
  • Zipalign in batch, save following code in .bat and put in your folder that contains .apk file. It will batch running zipalign all .apk inside, this guide I found from user Grumpy Old Man post at RootWiki. Thanks for this easier method.

    Code:
    @echo off
    
    REM Batch file to recursively zip align *.apk files in a directory
    
    REM and its sub-directories. This is significantly easier and faster
    
    REM than manually zip aligning them.
    
    @echo Zip aligning now...
    
    for /R %%X in (*.apk) do zipalign 4 "%%X" "%%~dpX%%~nX.new"
    
    @echo Replacing non-aligned files with zip aligned files...
    
    for /R %%X in (*.new) do move /Y "%%X" "%%~dpX%%~nX.apk"
    
    @echo Zip aligning done, press any key to exit
    
    pause
Phone: Samsung Galaxy Note 3 | | Kernel: Stock | ROM: X-Note 13.0 v4.4.2 KitKat - XXUENC2
Future Phone: Sony Xperia Z2

Ex. Phone: Nokia 3310, Samsung S500, Nokia 7610, 7270, 7280, SE K750, Nokia N73, LG Viewty KU990, Samsung Pixon, UltraTOUCH, OMNIA II, Nokia 3120 Classic, Google Nexus One, Samsung Galaxy S II, S III, Sony Xperia Z, Z Ultra

Tablet: Sony Xperia Tablet Z | ROM: v4.3 - 10.4.B.0.577
Future Tablet: Still Finding

Ex. Tablet: Google Nexus 10
The Following 5 Users Say Thank You to Andrewtst For This Useful Post: [ Click to Expand ]
 
Andrewtst
Old
(Last edited by Andrewtst; 14th April 2012 at 07:55 PM.)
#7  
Andrewtst's Avatar
Senior Member - OP
Thanks Meter 1255
Posts: 3,945
Join Date: Aug 2009
Location: Johor

 
DONATE TO ME
Final Step

OK, done everything? now you need to put back to your phone with 2 method
  • Flash via CWM - highly recommended
  • Root Explorer - not recommended as it may not properly change for Statusbar theming.

Using CWM
  • Make a flash-able .zip to flash at CWM
  • Not sure how to do, let use a easier way, take any flash-able .zip, use 7-zip and choose open archive as seen below:
  • Now just drag and drop all your modified .apk inside the .zip file, choose YES when ask "Confirm File Copy" as seen below:
  • Copy the modified .zip to your root SDCARD and restart to CWM and install. Done!

Using Root Explorer
  • Temporary copy your modified .apk to your /system/csc
  • Right click choose permission and set as below:
  • Move your current .apk to correct directory /system/app
  • Done! This method is not recommended for framework-res.apk & systemUI.apk, better way still flashing via CWM.

ENJOY HAPPY THEMES!
Phone: Samsung Galaxy Note 3 | | Kernel: Stock | ROM: X-Note 13.0 v4.4.2 KitKat - XXUENC2
Future Phone: Sony Xperia Z2

Ex. Phone: Nokia 3310, Samsung S500, Nokia 7610, 7270, 7280, SE K750, Nokia N73, LG Viewty KU990, Samsung Pixon, UltraTOUCH, OMNIA II, Nokia 3120 Classic, Google Nexus One, Samsung Galaxy S II, S III, Sony Xperia Z, Z Ultra

Tablet: Sony Xperia Tablet Z | ROM: v4.3 - 10.4.B.0.577
Future Tablet: Still Finding

Ex. Tablet: Google Nexus 10
The Following 5 Users Say Thank You to Andrewtst For This Useful Post: [ Click to Expand ]
 
Andrewtst
Old
(Last edited by Andrewtst; 19th April 2013 at 04:49 AM.)
#8  
Andrewtst's Avatar
Senior Member - OP
Thanks Meter 1255
Posts: 3,945
Join Date: Aug 2009
Location: Johor

 
DONATE TO ME
My Achievement

Below is what you can get after themes. Enjoy!





-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FROM BELOW, NOT RELATED TO S II - i9100G

CENTER CLOCK for SONY XPERIA Z phone.
De-compile the SystemUI.apk, then change some code at status_bar.xml in /res/layout

Step 1 - Find
Code:
<com.android.systemui.statusbar.policy.Clock android:textAppearance="@style/TextAppearance.StatusBar.Clock" 

android:gravity="left|center" android:id="@id/clock" android:paddingLeft="6.0dip" 

android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" />
Step 2 - Replace Step 1 code with
Code:
<com.android.systemui.statusbar.policy.Clock android:id="@id/clock" android:layout_width="fill_parent" 

android:layout_height="fill_parent" android:gravity="center_horizontal|center" 

android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:singleLine="true" />
Step 3 - Then search for
Code:
xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui">
and now cut Step 2 code and paste in bottom Step 3 code.

Step 4 - Lastly find
Code:
<LinearLayout android:orientation="horizontal" android:id="@id/ticker"
and past following code beside it.
Code:
android:background="@drawable/status_bar_background"
Save the edited status_bar.xml

Sony Xperia Z Center Clock Screenshot.
Phone: Samsung Galaxy Note 3 | | Kernel: Stock | ROM: X-Note 13.0 v4.4.2 KitKat - XXUENC2
Future Phone: Sony Xperia Z2

Ex. Phone: Nokia 3310, Samsung S500, Nokia 7610, 7270, 7280, SE K750, Nokia N73, LG Viewty KU990, Samsung Pixon, UltraTOUCH, OMNIA II, Nokia 3120 Classic, Google Nexus One, Samsung Galaxy S II, S III, Sony Xperia Z, Z Ultra

Tablet: Sony Xperia Tablet Z | ROM: v4.3 - 10.4.B.0.577
Future Tablet: Still Finding

Ex. Tablet: Google Nexus 10
The Following 9 Users Say Thank You to Andrewtst For This Useful Post: [ Click to Expand ]
 
fauzi_91
Old
#9  
fauzi_91's Avatar
Senior Member
Thanks Meter 201
Posts: 707
Join Date: Nov 2011
Location: B.B.Bangi
Very nice tutorial!i'm too lazy to type/make a tutorial..lol its good for sharing the idea..:thumbup:

Sent from my GT-I9100G using Tapatalk 2

Phone Owned : LG Nexus 4 / Galaxy S2 i9100G / HTC Wildfire
Dropbox : share
Twitter : fauzishari
The Following User Says Thank You to fauzi_91 For This Useful Post: [ Click to Expand ]
 
Andrewtst
Old
#10  
Andrewtst's Avatar
Senior Member - OP
Thanks Meter 1255
Posts: 3,945
Join Date: Aug 2009
Location: Johor

 
DONATE TO ME
Quote:
Originally Posted by fauzi_91 View Post
Very nice tutorial!i'm too lazy to type/make a tutorial..lol its good for sharing the idea..:thumbup:

Sent from my GT-I9100G using Tapatalk 2
Thanks, I am still learning.
Phone: Samsung Galaxy Note 3 | | Kernel: Stock | ROM: X-Note 13.0 v4.4.2 KitKat - XXUENC2
Future Phone: Sony Xperia Z2

Ex. Phone: Nokia 3310, Samsung S500, Nokia 7610, 7270, 7280, SE K750, Nokia N73, LG Viewty KU990, Samsung Pixon, UltraTOUCH, OMNIA II, Nokia 3120 Classic, Google Nexus One, Samsung Galaxy S II, S III, Sony Xperia Z, Z Ultra

Tablet: Sony Xperia Tablet Z | ROM: v4.3 - 10.4.B.0.577
Future Tablet: Still Finding

Ex. Tablet: Google Nexus 10

The Following 4 Users Say Thank You to Andrewtst For This Useful Post: [ Click to Expand ]
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes