How to configure the android simulator dex file not optimized to odex

Source: Internet
Author: User

How to configure the android simulator dex file not optimized to odex

APK is a compressed program package with an execution program in it. ODEX optimization is to extract the execution program in the package and convert it into an ODEX file, because you have extracted it, when the system starts for the first time, it does not need to decompress the program compressed package, and a decompression process is missing. In this way, the system starts up faster.

Recently, a module needs to dump the dex file loaded in the apk, so you need to configure dalvik not to optimize the dex file to odex.

1. Configure build. prop

Modify the configuration in the file/system/build. prop.

(1) dalvik. vm. dexopt-flags

This parameter controls the program code verification and optimization of the Dalvik virtual machine. You can enter m, v, and o values.

M is the standard option, which can be m = y or m = n. If m = y, the optimization of the validation and hosting code of Insecure code is enabled. The highest compatibility and security.

V is the verification option and can coexist with o. It can be v = a or v = n. If v = a, all codes are verified. If v = n, code verification is disabled.

O is the optimization option and can coexist with v. It can be o = v or o =. If o = v, the code is optimized for verification, and if o = a, all codes are optimized.

Here we configure dalvik. vm. dexopt-flags = v = n, o = v, indicates that the code verification is disabled and only the code that has been verified is optimized, that is, all codes are not optimized.

(2) dalvik. vm. checkjni

Here we configure dalvik. vm. checkjni = false, which sets checkjni to false.

2. persists the configuration to the simulator.

(1) first re-mount the system partition to make the system partition writable. If you do not execute this operation, you cannot modify the build. prop file.

Adb remount

(2) Next, enter the command line of the simulator:

Adb shell

(3) write the configuration to build. prop:

Echo "dalvik. vm. dexopt-flags = v = n, o = v ">/system/build. propecho "dalvik. vm. checkjni = false ">/system/build. prop

In this way, the preparation is changed to the simulator. After verification, it is found that dex is not converted into odex.

However, after restarting the simulator, we found that no changes were made in build. prop.

Search on the Internet, refer to the stackoverflow question: http://stackoverflow.com/questions/15417105/forcing-the-android-emulator-to-store-changes-to-system

The procedure is as follows:

(1) Copy system. img to a place,

(2) run the following command to start the simulator:

Emulator-avd [Your simulator name]-qemu-nand system, size = [the space required by the simulator, in hexadecimal format], file = [directory copied just now]/system. img

For example:

Emulator-avd Galaxy_Nexus-qemu-nand system, size = 0x1f400000, file =/home/fx/. android/avd/Galaxy_Nexus/system. img

(3) follow the previous steps to modify build. prop

(4) Use this command to disable the simulator:

Adb-e emu kill

In this way, when the simulator is started normally Next time (you do not need to use the commands in step 2 above), you will find that the modified content has been persistently stored in build. prop.

Note: For more exciting tutorials, please follow the help houseDesign tutorialTopic,

Related Article

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.