Recently, to do a module, you need to dump the Dex file loaded inside the APK, so you need to configure the Dalvik not to optimize the Dex file to Odex.
1. Configure Build.prop
Mainly by modifying the configuration inside the file/system/build.prop.
(1) Dalvik.vm.dexopt-flags
This parameter controls the program code checksum optimization of the Dalvik virtual machine. The available values are M, V, and O.
M is the standard option, which can be m=y or m=n. If m=y, enable validation of unsafe code and optimization of managed code. Highest compatibility and security.
V is the CHECK option and can coexist with O. It can be v=a or v=n. If v=a means verifying all the code, v=n turns off the checksum of the code.
O is an optimization option that can coexist with V. It can be o=v or o=a. If O=v is optimized to validate the code, o=a means that all the code is optimized.
Here we configure: Dalvik.vm.dexopt-flags=v=n,o=v, which means to turn off code validation and only optimize the checked code, i.e. all code is not optimized.
(2) Dalvik.vm.checkjni
Here we configure: Dalvik.vm.checkjni=false, this will set the Checkjni to False
2. Persist the configuration to the simulator
(1) First re-mount the system partition to make the system partition writable. If you do not do this, you will find that 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 configuration is changed into the simulator, and after verification found that Dex was not converted into Odex.
But after restarting the simulator, I found that the changes in Build.prop were gone.
Search on the Internet, refer to this stackoverflow question: http://stackoverflow.com/questions/15417105/ Forcing-the-android-emulator-to-store-changes-to-system
The steps are as follows:
(1) Copy the system.img to a place,
(2) Start the emulator with the following command:
EMULATOR-AVD [your simulator name]-qemu-nand system,size=[Simulator required space, 16 binary],file=[The directory you just copied]/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 the Build.prop
(4) Close the emulator with this command:
Kill
This way, the next time you start the simulator normally (you don't have to use the command in step 2 above), you find that the modified content has been persisted to Build.prop.