Android odex conversion dex instructions

Android  development often needs to solve some compatibility problems. Usually, we will pull out the pre-installed app of the corresponding system, and reverse its structure to see what it is. During the process, we will find that there are some roms in the /system/app directory in the form of xxx.odex files, so what is odex?

Odex is the abbreviation of Optimized dex, which is the optimized dex file. The odex file depends on the compiled system modules in the system, generally the jar package in the /system/framwork directory. The purpose is also to improve the running speed of the Dalvik virtual machine. It can be said that from class to dex is  a general optimization for the android platform , odex is a special optimization of dex files in different mobile phone roms. Friends who are interested in this can read Teacher Deng Fanping's in-depth understanding of Android's Java virtual machine Dalvik.

The main content of the article is to introduce how to convert odex to dex.

1. If you want to do good work, you must first sharpen your tools. After configuring the jar environment, go to bitbucket.org to download four files, smali-xxx.jar, baksmali-xxx.jar, baksmali, and smali, and put them in the local directory test .

2. Convert odex to smali 
and copy the corresponding odex file to the test directory, copy the jar package in /system/framwork to the test/framwork directory, and run the following command:

Java -jar baksmali-xxx.jar -x test.odex -d framework

3. Convert smali to dex

java -jar smali-xxx.jar out -o test.dex

-o,–output the directory where the disassembled files will be placed. Default is out. 
-d,–bootclasspath-dir the base folder to look for the bootclasspath files in. 
-v,–version prints the version then exits 
-x,–deodex deodex the given odex file.

Because the optimization of odex depends on a specific os, when using baksmali, the library file of the Android system is still required. If the jar package in the framework is missing, the parsing will fail. There are also friends on the Internet who integrate these command lines into a bat, you can refer to  android APK to extract the built-in software odex to dex  .

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326261719&siteId=291194637