Dex and Odex convert each other

Source: Internet
Author: User

One, Dex and Odex

Dex is an executable file for the Android Dalvik virtual machine that can be opened directly in the exported APK file using the Unzip software. Odex is optimized for Dex. Odex one is extracted from the APK program, and the APK file in the same directory, the file suffix is odex, such odex files are mostly Android ROM system program, and another cache file, such odex still with Dex suffix, stored in cache/ The Dalvik-cache directory. The file name format is "apk path @apk name @class.dex", for example "[email protected]@[email protected]", means/system/ The Odex file for the CALCULATOR.APK program in the app directory.

Ii. Dex conversion to Odex

Use Dexopt-wrapper to convert Dex to Odex. Dexopt-wrapper can be found in the source code before Android 2.3. The Dex-wrapper is compiled and placed on the phone.

ADB push dexopt-wrapper/data/local
chmod 777 /data/local/dexopt-wrapper

Feel free to extract a Dex file from the apk file, rename it classex.dex,zip to compress it and rename it to Hellodex.zip

ADB push Hellodex. zip /data//data/Local. /dexopt-wrapper Hellodex. Zip Hellodex.odex

If you execute error-free, you will have the following output

./dexopt-wrapper Hellodex. Zip Hellodex.odex ' Hellodex.zip ' (bootstrap=0 for verify+opt, pid=721--- would reduce privshere' Hellodex.zip ' (Success)---

The current directory will have a hellodex.odex file. It is now easy to export it for later operation.

ADB pull/data/local/hellodex.odex d:\
Iii. Odex conversion to Dex

The principle of converting Odex to Dex is to convert the Odex into a Smali file before turning the Smali file into a dex file. Need to download Smali.jar and Baksmali.jar.

Java-jar Baksmali.jar-x Hellodex.odex

You may have the following error:

Export the/system/framework folder in your phone. Into the framework folder in the Odex directory.

Execute command

Java-jar baksmali.jar-x hellodex.odex-d Framework  /-D means specifying the framework directory

If there is no output without errors, the working directory ends up as follows, and the Out directory saves the directory for the exported Smali.

Next, convert the Smali to Dex

Execute command

Java-jar Smali.jar out-o outhellodex.dex  // convert out directory to outhellodex.dex file

If there is no error, no output. The Outhellodex.dex file is generated under the current directory.

Iv. Related Downloads

All Downloads

Dex and Odex convert each other

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.