Quantcast
Channel: xda-developers - XPERIA X8 General
Viewing all articles
Browse latest Browse all 317

Deodex A Single Application

$
0
0
Hey Guys,

This is a small tutorial for those who want to Deodex a Single Application manually.

Deodex And Odex:
The APKs or JARs of Android contain certain .odex files whose supposed function is to save space. These ‘odex’ files are actually collections of parts of an application that are optimized before booting. Doing so speeds up the boot process, as it preloads part of an application. On the other hand, it also makes hacking those applications difficult because a part of the coding has already been extracted to another location before execution.It will make your faster theoretically even though it would be too small to notice.When deodexing the .odex file is changed to classes.dex file. Deodexing also allows us to theme and install mods.Many of the Stock Roms and CyanogenMod 7 roms are now odexed and to theme them or to add mods we need to have it deodexing so lets learn how!!

Deodexing:

Preparation:
  1. Download the Attached .zip File
  2. Extract its Contents to a Folder.(Extracting to a New Folder in the Desktop is Preferred for Ease)
  3. We will name this Folder with the Extracted Contents as Deodex(or any name that you like)

Procedure And Explanations:

First of all copy the Application file that you need to Deodex.A Android Application file is the .apk file found in the system/app directory.Copy the .apk file and the .odex file of the application that you want to Deodex and paste in the Deodex folder(Folder to which the attachment's contents was extracted)
Now go to your system/framework directory and you can see a lot of .jar and .odex files in this folder and copy all its contents to the folder to which the attachment's contents was extracted.
Before doing anything more backup your rom and the application file(If anything goes wrong you can use it then)

To Deodex a application you need to specify its "BOOTCLASSPATH" files. BOOTCLASSPATH are files that contain the classes for an application or in simple language BOOTCLASSPATH files are those files that are required by a android application to run properly. They are actually those files that we have copied from the system/framework directory to our Deodex folder. There are mainly 5 BOOTCLASSPATH files for every android rom.They are: android.policy.jar , core.jar , bouncycastle.jar , ext.jar , framework.jar
All apps are dependent on these files but some apps are dependent on some other BOOTCLASSPATH files.So sometimes the problem is that we actually dont know to which of these files is a particular app dependent to.So we will have to specify all the BOOTCLASSPATH files or the .jar files in the system/framework directory.So problem solved!! Now enough with the theory class,lets proceed to the practical classes!!!!!

Open Command Prompt.
As an example we will Deodex Settings.apk

Type in this command in Command Prompt:
java -Xmx1024m -jar baksmali.jar -c :am.jar:android.policy.jar:android.test.runner.jar :bmgr.jar:bouncycastle.jar:
com.android.location.provider.jar:com.google.andro id.maps.jar:sonyericsson.suquashi.jar:
core.jar:corej-unit.jar:ext.jar:framework.jar:ime.jar:input.jar:j ava.awt.jar:javax.obex.jar:monkey.jar:pm.jar:
:services.jar:sqlite-jdbc.jar:svc.jar -x Settings.odex

Here:
-Xmx says the heap memory needed.In the above command it is given to 1024m. Sometimes deodexing may have errors due to the low heap memory.So set it to 1024m itself.

-jar baksmali.jar says the program to run baksmali.jar file.

-c says that the following files are the BOOTCLASSPATH files of the application we are deodexing.

-x says the name of the application that we are deodexing.It should end with .apk extension.

Note:
When you specify the .jar files just add all those .jar file names in the system/framework folder.Ensure that you have added the .jar extension at the end of each file. Separate the .jar files with " : " symbol.

If you have made no spelling errors and have done everything mentioned you will get a folder named "out".
Now we have to smali the out folder into classes.dex file.

So again type in the Command Prompt:
java -Xmx1024m -jar smali.jar out -o classes.dex

Here:

-o says what the output file should me named to.Dont rename the classes.dex file into anything else.

Now you will have a file in our Deodex folder(Folder to which the attachment's contents was extracted) called "classes.dex".

Finalizing:

Now open the application's .apk file(which you were trying to deodex) with WinRar.
Move the classes.dex file that you got to this .apk file.(Just drag and drop it to the .apk file opened with WinRar.)

Now you will have a deodexed .apk file.

Note: After deodexing you will have to delete the .odex file of the particular application which you had deodexed.


I will make a guide to Odex back a Deodexed application soon!

Hope this guide helps you....

For any doubts or questions please post it here in this forum.......

Attached Files
File Type: zip Deodex.zip - [Click for QR Code] (2.90 MB)

Viewing all articles
Browse latest Browse all 317

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>