Saturday, December 1, 2012

How to Compile and Discompile with APK Tool



NOTE : DO WITH YOUR OWN RISK. I'M NOT GUARANTEED FOR ANY BOOTLOOP OR STUCK IF IT'S HAPPEN YOU SHOULD RE-FLASH YOUR PHONE.


What is decompiling? Android apps are BASICALLY made up of Java codes and XML files. After compiling the app, these files cannot be viewed. Decompiling is a process
which decompiles the binary form of XMLs and .Java files into readable form. The XML files can be retained as it is, but the .java files are converted into smali files, a totally different language.

What is recompiling? Recompiling is simply a way to convert the XML and smali files back into the binary form and building up of the APK with the changes made. All apps after recompiled have to be signed (except system apps).

Tool needed :
JRE (Java Runtime Environment)
http://www.oracle.com/technetwork/java/javase/downloads/jre-7u2-download-1377135.html
Apktool
(Find it on google)
  •   Extract on some folder
  •  Before Compile and Decompile, Install Framework-res.apk First (At least once)
  • Put Framework-res.apk into folder that you've been extracted
  • Open Command Prompt.bat That include in that folder. Type:
  •     apktool if framework-res.apk (enter)
  • Clear
  • Now, we will doing editing process. Example, We will edit SystemUI.apk
  • Put SystemUI.apk from your phone, into that folder.
  • Decompile SystemUI which doing. open Command Prompt.bat, type: apktool d SytemUI.apk (enter)
That will appeat SytemUI. Now In this folder contains files that are in decompile so we can edit. Whether it's to change the image, change the XML file, and so on. Examples such as the XML file that when opened directly from decompile SystemUI.apk without in advance will not be legible. If you already like this then decompile the XML file that is in SystemUI.apk will be read and opened with ordinary notepad though.
     If you've done editing, do the compilation. Type:
            apktool b SystemUI (without. apk, then enter).
     The process is quite long
     After some time in the SystemUI folder will create a new folder called build and dist. SystemUI file in the dist folder can not be used directly in our android because it is unsigned apk.
     Next, open the folder SystemUI / build / apk. Then open the file SystemUI.apk with WinRAR. Here we will overwrite / replace files.
     Remember what files are already in the edit was. The files are overwritten live aja. Example: You edit the files in the folder status_bar.xml SystemUI / res / layout. So status_bar.xml file is in SystemUI / build / apk / res / layout stayed drag it to SystemUI.apk / res / layout (drag n drop).
     If you've done editing, insert it into the SystemUI mm. Can be a way through root explorer (make sure the attention permission'a) or by creating a flashable file.


note:
  if the file in the edit does not exist in the build folder, then as ganti'a copy ... \ build \ apk \ resources.arsc into the apk that we edit (use winrar to open the apk, do drag n drop)
     if we edit smali files, copy the ... \ build \ apk \ classes.dex (and resources.arsc for safety)
 

0 comments:

Post a Comment

Followers

 

Samsung Galaxy Y S5360. Copyright 2008 All Rights Reserved Revolution Two Church theme by Brian Gardner Converted into Blogger Template by Bloganol dot com