) Odex knowledge

Source: Internet
Author: User
There are many odex files in the android Rom. What is the role of this odex file relative to the DEX file in the APK? If you observe carefully, you will find that the file names correspond one by one, and the corresponding APK files do not contain Dex files. In this way, the vendor can ensure anti-piracy, because the APK without the DEX file cannot be installed normally, the vendor directly puts the odex and incomplete APK files in the ROM of the mobile phone to solidify them into/system/bin, which will make the general user unable to export and use them normally.

You may think of merging odex and APK into an APK that contains the DEX file. In this way, the final APK file is installed in/data/, and the Rom is stored in/system/app, as a result, the software that users can install on Android phones will become less and occupy system space.

I. How to generate an odex file using APK:

Compile build/tools/dexpreopt/dexopt-wrapper on open-source git. Use dexopt-wrapper.

Put dexopt-wrapper in the/data/local directory, run the Linux Command Line using the ADB shell, and run the CD command to enter the/data/local directory,

CD/data/local

./Dexopt-wrapper android123.apk android123.odex

2. Merge the APK files of odex and Shao Dex into a complete APK file.

1. Download The http://smali.googlecode.com/files/smali-1.2.2.jar and directories/system/framework

2. Generate a class file through odex

Java-jar baksmali-1.2.2.jar-x android123.odex

After executing the preceding command, a class file named android123.odex in the out folder is generated. If a problem occurs, you can generate it from the Java environment variable in the/system/framework of Rom to the PC as prompted.

3. Generate the classes. Dex file through the class.

Java-xmx512m-jar smali-1.2.2.jar out-O classes. Dex

4. Put classes. Dex in the APK file.

Because APK is the mime encoding type of zip, use WinZip or WinRAR to drag it directly to the APK and change it to zip

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.