1. 程式人生 > >[Android] 從模擬器永久刪除系統apk

[Android] 從模擬器永久刪除系統apk

這裡介紹的方法是無需重新打包system.img以及可以從system.img中永久刪除系統apk。

1.Goto…….\android-sdk_r08-windows\android-sdk-windows\platforms\android-9\images(this is the default folder forSDK Platform Android 2.3, API 9, revision 1), copysystem.imgandpasteit toC:\Users\Username\.android\avd\Emulator’s name.avd

2.Modify hardware-qemu.ini, change:

disk.systemPartition.initPath =

C:\Users\Username\.android\avd\Emulator’s name.avd/system.img

3.Type the following:emulator –avd avd-name –partition-size 100and hitEnter(please replaceavd-namewith your emulator’s name). This command will launch your emulator. Please don’t try to launch it from SDK manager, otherwise, it won’t work.

4.Launch another command prompt window, switch to…….\android-sdk_r08-windows\android-sdk-windows\tools ,type in:adb -s emulator-5554 shelland hitEnter

5.Now, type in: mount -o remount,rw -t yaffs2 /dev/block/mtdblock0 /systemand hitEnter. This will remount the/systemin read-write mode. Because we will copy some files to

/system/applater, we must set read-write permission to that directory. To do it, type the following:chmod 777 /system/app, hitEnter. After that, you need to exit. Typeexit, hitEnteragain.

6.Now, you need to removeSdkSetup.apkfrom/system/app(if it is not removed, the SDK will be restore in next session). In the second command prompt window, type:adb shell rm /system/app/SdkSetup.apk ,hitEnter.

7.Backup system.img, copy temp file from C:\Users\UserName\AppData\Local\Temp\AndroidEmulator\ to C:\Users\Username\.android\avd\Emulator’s name.avd/

8.Close your emulator.

9.Go toC:\Users\Username\.android\avd\Emulator’s name.avdand delete these two files:userdata-qemu.imgandcache.img.

10.Rename temp file to system.img

11.Launch your emulator in the normal way.