[Android] configure the Android simulator so that the dex file is not optimized to odex.

Source: Internet
Author: User

1. Configure build. prop by modifying 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: dalvik. vm. checkjni = false, which sets checkjni to false. 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. in this way, the prop 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 specific steps are as follows: (1) Will system. copy the img to a local location. (2) run the following command to start the simulator: emulator-avd [Your simulator name]-qemu-nand system, size = [space required by the simulator, hexadecimal], file = [directory copied just now]/system. img 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 the buil D. prop (4) Use this command to disable the simulator: adb-e emu kill. The next time the simulator is started normally (you do not need to use the commands in step 2 ), it is found that the modified content has been persisted to build. prop.

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.