问题
I have followed the answers from this question without success. I could not respond to the posted answer (lack of reputation) so I had to make a new question.
Purging all adb processes does not alleviate the 'SD Card image already in use' error. Similarly, if I delete the SD card image, create a new one, then immediately launch the emulator, the error persists. After the emulator loads to the phone home screen, an "SD Card Removed" message is displayed. Here is what my command line looks like when calling the emulator:
jet98f@rc04ucs213:/mnt/dfs/jet98f/Users/jet98f/android-sdk-linux/tools$ emulator -avd Phone -sdcard sdcard.iso
WARNING: Data partition already in use. Changes will not persist!
WARNING: SD Card image already in use: sdcard.iso
WARNING: Cache partition already in use. Changes will not persist!
Failed to symlink /nethome/users/jet98f/.pulse/f4ac236e8e0d8ef32a8796d24e3c758b-runtime to /tmp/pulse-2L9K88eMlGn7: Operation not supported
emulator: emulator window was out of view and was recentered
EDIT: One more thing: running 'lsof | grep sdcard ' results in no returns. That is, the UNIX utility says the file is not open, yet adb claims the image is already in use.
回答1:
Delete lock pid files?
I am on Windows7 and was having the same problem with the SD Card image, as well as general problems with Eclipse not wanting to connect with the Adb. The state seems to get out of sync.
In windows, there are lock files. In my case (environment, if you will) it is C:\Users\joe\.android\avd\Em22.avd\xxx\pid
where xxx are:
- cache.img.lock
- hardware-qemu.ini.lock
- sdcard.img.lock <<<---
- userdata-qemu.img.lock
When the state of eclipse seems lost, I shut everything down, and delete the pid files in the lock directories. It did the trick in at least one occasion where Eclipse would not connect with adb, and when it did, complained about locked sd card image.
Ooops, I just noticed it has the same answered in link in original question.
回答2:
Here is the solution, 1) Open Task Manager. 2) Close all the running emulators from list. 3) Close bluestack programs if running any. 4) Now you are done. You can now run New emulator.
回答3:
The sdcard image should be a writeable FAT32 image file. See this link
It seems you are using an ISO image.
If you really suspect there's another process (emulator) using a specific sdcard image you can confirm it by running
$ fuser ~/.android/avd/4.0.3.avd/sdcard.img
~/.android/avd/4.0.3.avd/sdcard.img: 90719
in this case there's an emulator running (or something else having the file opened) (pid 90719).
来源:https://stackoverflow.com/questions/10021471/android-emulator-sd-card-image-already-in-use