FORUMS

[GUIDE][THEMING][BASICS] Let's get ready and theme Lollipop ROMs!

5,299 posts
Thanks Meter: 10,097
 
Post Reply Subscribe to Thread Email Thread
Let's get ready and theme/decompile Lollipop ROM APKs!


Hey all, it's me again. I might as well be posting my entire workstation/methods here for people to learn how to get into the theming world. This is the traditional method of theming, so this would be useful for prospective themers/ROM developers alike.

NOTE: I'll be doing this on an AOSP/CM/Google based ROM, and if you are wondering if it works on TW/Sense, I do not know, but it should work the same.

In this guide, I won't be going so in depth like @Vivek_Neel, so you can go check out his thread: http://forum.xda-developers.com/andr...guide-t2978121 I'll be going over the BASICS of getting started to theme and how to go to his theme thread and start contributing.

Table of Contents
  1. Setting up the Java SE Runtime Environment
  2. Decompiling your first time
  3. Compiling your first time
  4. Creating a flashable zip
  5. Repetitive? Let's simplify it using batch files.
  6. Porting my themes or other themes to specific ROMs (WIP)

Please do note, this IS for beginners, so I'll try and respond to errors and problems when setting up your environment and using my compiling packages.
Last edited by nicholaschum; 17th January 2015 at 04:33 AM.
The Following 36 Users Say Thank You to nicholaschum For This Useful Post: [ View ]
 
 
16th January 2015, 07:43 PM |#2  
nicholaschum's Avatar
OP Recognized Themer
Flag University of Toronto St. George (Hometown: Hong Kong)
Thanks Meter: 10,097
 
Donate to Me
More
Setting up the Java SE Runtime Environment
Setting up the Java SE Runtime Environment

First of all, to make sure everything goes well, it is recommended that you set up your entire JRE on your computer.
I'm on Windows 8.1 so I'll be using screenshots from an 8.1 setup.

STEP 1: Install these two files:
- JRE8 (This is what I use): http://www.oracle.com/technetwork/ja...s-2133155.html
- JDK8 (Install just in case): http://www.oracle.com/technetwork/ja...s-2133151.html

STEP 2: Setting up JDK JAVA_HOME environment variable:
  1. After installing the two files above, locate your JDK location, in my case, mine is C:\Program Files\Java\jdk1.8.0_20.
  2. Then open up your Control Panel and click into System (Control Panel\All Control Panel Items\System)
  3. Click on Advanced system settings in the sidebar.
  4. A popup will appear, click on the Advanced tab, then click on "Environment Variables..."
  5. Another smaller popup, Environment Variables, will open up. Click on "New..."
  6. According to the screenshot, click type in the Variable name (JAVA_HOME) and Variable value (Location of your JDK set up).
  7. After everything is done, click OK on all popups, then reboot your computer.
  8. You are now ready for apps like Virtuous Ten Studio and Android Studio, futureproofing yourself for now.
Last edited by nicholaschum; 6th August 2015 at 08:19 PM.
The Following 13 Users Say Thank You to nicholaschum For This Useful Post: [ View ]
16th January 2015, 07:43 PM |#3  
nicholaschum's Avatar
OP Recognized Themer
Flag University of Toronto St. George (Hometown: Hong Kong)
Thanks Meter: 10,097
 
Donate to Me
More
Decompiling your first time
Decompiling your first time

STEP 1: Create your working directory
- Make a directory wherever you want, for example on the desktop. Name the folder something easily memorable, e.g. WORKING AREA (C:\Users\Nicholas\Desktop\WORKING AREA\)


STEP 2: Download these two files:
- Latest APKtool.jar by @iBotPeaches: https://bitbucket.org/iBotPeaches/ap...tool_2.0.1.jar
- apktool-install-windows-r05-ibot.tar.bz2: https://code.google.com/p/android-ap...downloads/list


STEP 3: Place all files into the working folder



STEP 4: Rename apktool_2.0.1.jar to apktool.jar



STEP 5: Put your desired APK you want to decompile into directory (This can be framework-res.apk)


STEP 6: Put your ROM's framework-res.apk into the directory (If done in Step 5, skip this)


STEP 7: Installing the framework-res into apktool's resources.
- Shift + Right Click on a blank spot in the working directory, then click "Open command window here..."
- Type this code in, then click enter
Code:
apktool if framework-res.apk
- Your framework will be installed, ready for apktool to use it.


STEP 8: Decompile your desired APK
- Shift + Right Click on a blank spot in the working directory, then click "Open command window here..."
- Type this code in, then click enter
Code:
apktool d apkname.apk
- Your apk will be decompiled into your working directory -> apkname folder (e.g. C:\Users\Nicholas\Desktop\WORKING AREA\SystemUI)
- A small breakdown of the code is like this: apktool (calling the program) d (decompile) apkname.apk (apk input)


STEP 9: Edit your apk file!
- You can follow Vivek's thread for what to change in a specific APK file, linked here: http://forum.xda-developers.com/andr...guide-t2978121
Last edited by nicholaschum; 6th August 2015 at 08:18 PM. Reason: Updated links as of 08-06
The Following 17 Users Say Thank You to nicholaschum For This Useful Post: [ View ]
16th January 2015, 07:44 PM |#4  
nicholaschum's Avatar
OP Recognized Themer
Flag University of Toronto St. George (Hometown: Hong Kong)
Thanks Meter: 10,097
 
Donate to Me
More
Compiling your first time
Compiling your first time

To recompile, you need to have the android-sdk handy, as you'll need the zipalign.exe from it.

REQUIREMENTS
- 7-Zip installed: http://www.7-zip.org/


STEP 1: Install Android SDK from Android Studio
Android Studio: http://developer.android.com/sdk/index.html


STEP 2: Copying zipalign.exe into your working directory
- Navigate into C:\Program Files (x86)\Android\android-studio\sdk\build-tools\android-4.4W and copy zipalign.exe into your working folder.


STEP 3: Compiling your decompiled app into an APK file
- Shift + Right Click on a blank spot in the working directory, then click "Open command window here..."
- Type this code in, then click enter
Code:
apktool b appname appname.apk
- Your framework will be installed, ready for apktool to use it.
- NOTE: appname should be the same as the decompiled app's folder name.


STEP 4: Zipaligning your app
  1. At this point, you should have your original APK located directly inside your working directory.
  2. Your compiled app will be placed inside your working directory -> appname folder -> dist folder.
  3. Double click your compiled APK and open it with 7-zip.
  4. Double click your original APK and open it with 7-zip.
  5. In your original APK opened in 7-zip, drag META-INF and AndroidManifest.xml into the compiled APK's 7-zip window. Click Yes to overwrite.
  6. Take your compiled APK and place it in a new folder in your working directory (e.g. C:\Users\Nicholas\Desktop\WORKING AREA\ZIPALIGN)
  7. Drag "zipalign.exe" into the new folder ZIPALIGN.
  8. Paste the compiled APK with the original META-INF and AndroidManifest.xml into the ZIPALIGN folder.
  9. Rename the apk from apkname.apk to apkname-t.apk (Just add a "-t" to distinguish from your output apk later)
  10. Shift + Right Click on a blank spot in the ZIPALIGN directory, then click "Open command window here..."
  11. Type this code in, then click enter
    Code:
    zipalign -v 4 appname-t.apk appname.apk
  12. Your output APK will be available to flash now.
Last edited by nicholaschum; 16th January 2015 at 09:46 PM.
The Following 12 Users Say Thank You to nicholaschum For This Useful Post: [ View ]
16th January 2015, 07:44 PM |#5  
nicholaschum's Avatar
OP Recognized Themer
Flag University of Toronto St. George (Hometown: Hong Kong)
Thanks Meter: 10,097
 
Donate to Me
More
Creating a flashable ZIP for yourself
Creating a flashable ZIP for yourself

Download my Flashable ZIP template here: https://www.androidfilehost.com/?fid=95897840722644285

STEP 1: Designing your updater-script (What get's shown in TWRP/CWM when flashing)
This is my updater-script from the zip file:
Code:
ui_print(" =============================================");
ui_print("    Flashable ZIP Template by Nicholas Chum");
ui_print(" =============================================");
ui_print(" ");
sleep(1);
ui_print("     Now mounting the system writeable....");
sleep(1);
ui_print(" ");
run_program("/sbin/busybox", "mount", "/system");
ui_print("             Copying the files...         ");
sleep(1);
package_extract_dir("system", "/system");
sleep(1);
ui_print(" ");
ui_print("             File copy complete.          ");
unmount("/system");
sleep(1)
- This installs everything in the system folder of the ZIP file into the system folder on your phone.


STEP 2: Structure your APK into the correct directories of the ZIP according to your phone's layout
- If you want to install SystemUI.apk, you cannot install it like on KitKat due to different directory structure, so for example, the correct location to install SystemUI.apk would be /system/priv-app/SystemUI/SystemUI.apk, so you'll have to create your own subfolders in the zip according to the apk you want to install.

STEP 3: After you're done, flash and have fun!
Last edited by nicholaschum; 16th January 2015 at 09:47 PM.
The Following 14 Users Say Thank You to nicholaschum For This Useful Post: [ View ]
16th January 2015, 07:44 PM |#6  
nicholaschum's Avatar
OP Recognized Themer
Flag University of Toronto St. George (Hometown: Hong Kong)
Thanks Meter: 10,097
 
Donate to Me
More
Repetitive? Let's simplify it using batch files
Repetitive? Let's simplify it using batch files

I have a batch file collection here, check it out: https://www.androidfilehost.com/?fid=95897840722644292

To use my batch files, you may have to edit each batch file to confirm locations for directories on your computer.

These are the bat files you will have to edit: FRAMEWORK (Step 1) - Uninstall.bat, FRAMEWORK (Step 2) - Install.bat

You'll have to edit in your user account name, for example in FRAMEWORK (Step 1) - Uninstall.bat:
Code:
rd /s /q C:\Users\Nicholas\apktool
Afterwards, it will work perfectly.

The point of Theming Tools.zip is to allow you to easily make new working directories and just copying everything in from the zip file to the working directory to save your time from moving files over (zipalign.exe, apktool.jar, apktool.bat...etc)

To use my batch files, use it in this order
  1. Create working folder
  2. Place framework-res.apk in the working folder
  3. FRAMEWORK (Step 1) - Uninstall.bat
  4. FRAMEWORK (Step 2) - Install.bat
  5. Place your other APKs in, my batch only decompiles framework-res.apk, SystemUI.apk, Settings.apk, DocumentsUI.apk, TeleService.apk, so if you have another APK you want to automate, copy the structure of my calls in the batch file, then save it.
  6. BUILD (Step 1) - Extract Starter 5 APKs.bat
  7. Start theming your apps.
  8. After you're done...
  9. BUILD (Step 2) - Compile New 5 APKs.bat
  10. Now open each of the original APKs in the working directory, then copy each META-INF and AndroidManifest.xml from the original to the new compiled ones.
  11. Place each unzipaligned apks with the META-INF and AndroidManifest.xml into the BUILD ME folder - my batch only zipaligns framework-res.apk, SystemUI.apk, Settings.apk, DocumentsUI.apk, TeleService.apk, so if you have another APK you want to automate, copy the structure of my calls in the batch file, then save it.
  12. After you're done...
  13. BUILD - Zipalign All 5 APKs.bat
  14. Place all files into a flashable zip.
  15. Enjoy!
Last edited by nicholaschum; 16th January 2015 at 09:47 PM.
The Following 14 Users Say Thank You to nicholaschum For This Useful Post: [ View ]
16th January 2015, 07:45 PM |#7  
nicholaschum's Avatar
OP Recognized Themer
Flag University of Toronto St. George (Hometown: Hong Kong)
Thanks Meter: 10,097
 
Donate to Me
More
Last hold, just in case.
The Following 7 Users Say Thank You to nicholaschum For This Useful Post: [ View ]
16th January 2015, 07:46 PM |#8  
fahadali2315's Avatar
Senior Member
Flag Nottingham
Thanks Meter: 6,067
 
Donate to Me
More
👍👍👍Hold it right there .
The Following 3 Users Say Thank You to fahadali2315 For This Useful Post: [ View ]
16th January 2015, 07:50 PM |#9  
nofx161's Avatar
Senior Member
somewhere far far away
Thanks Meter: 245
 
More
looking forward to that!!!! nice work
The Following 2 Users Say Thank You to nofx161 For This Useful Post: [ View ]
16th January 2015, 11:57 PM |#10  
djdarkknight96's Avatar
Recognized Themer
Flag Springfield
Thanks Meter: 36,446
 
Donate to Me
More
Very nice my friend, we needed something like this for noobs. Sending them ALL your way..... Lol
The Following 9 Users Say Thank You to djdarkknight96 For This Useful Post: [ View ]
17th January 2015, 03:54 AM |#11  
Vivek_Neel's Avatar
XDA: ASSIST
Recognized Contributor / Themer
Flag Bangalore
Thanks Meter: 24,328
 
Donate to Me
More
Quote:
Originally Posted by djdarkknight96

Very nice my friend, we needed something like this for noobs. Sending them ALL your way..... Lol

Haha.
+1.

Very nice and handy
The Following 4 Users Say Thank You to Vivek_Neel For This Useful Post: [ View ]

Read More
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes