Can't delete virtual device from Eclipse, android

AndroidAndroid Emulator

Android Problem Overview


I have multiple virtual devices, some of them can't be deleted.

Error message is

> The android virtual device XXX is currently running in an emulator and > cannot be deleted

when I just have restarted Ubuntu and only started Eclipse.

Android Solutions


Solution 1 - Android

In Linux/*nix and OSX:

  1. Find the .android folder in your $HOME directory.
  2. In .android there should be a avd folder
  3. In the avd folder should be one or multiple .ini file and a corresponding *.avd virtual device folder.
  4. Delete both the *.ini file and the *.avd folder you want to get rid of.
  5. Return to the Android sdk and AVD manager.

I hope this helps...

Solution 2 - Android

In the /home/.android/[your device].avd folder sometimes are left behind *.lock files. This can be because of unexpected emulator termination. AVDM doesn't deal with this. Deleting manually a device folder or overriding it solves the problem.

Before trying to delete a virtual device in AVDM. Remove all *.lock files from the corresponding /home/.android/[your device].avd fodlers. You will then be able to delete without the 'device XXX is currently running' popup.

Solution 3 - Android

An alternative and much simpler solution that works from the AVD manager.

From the AVD manager click the New button. Set the name as the name of the device that you can't close, choose any settings, and tick the box that says Override the existing AVD with the same name.

This will kill the old one and overwrite with the new one. The new one isn't running and so can be deleted.

Solution 4 - Android

I've been looking for the java code and this error really mean you have an AVD running... Have you tried kill'em all with top or htop (which is way better).

    // check if the AVD is running
    if (avdInfo.isRunning()) {
        display.asyncExec(new Runnable() {
            public void run() {
                Shell shell = display.getActiveShell();
                MessageDialog.openError(shell,
                        "Delete Android Virtual Device",
                        String.format(
                                "The Android Virtual Device '%1$s' is currently running in an emulator and cannot be deleted.",
                                avdInfo.getName()));
            }
        });
        return;

Solution 5 - Android

From Finder(OSX)OR Directory Explorer(Linux & Windows)

  1. Find the .android folder [Hidden Folder] in your $HOME directory. Show/Hide Folders on MAC
  2. In .android there should be a [Your Device].avd folder
  3. Find *.lock files and delete inside [Your Device].avd folder

From Android Studio

  1. Open AVD Manager
  2. Select virtual device that you want to delete
  3. Click down arrow at the end and select [Show on Disk] it will open directory
  4. Find *.lock files and delete inside [Your Device].avd folder

After these steps it will allow you to delete from AVD Manager

Solution 6 - Android

I had this issue as well.. was not able to find/see the .android folder in $home. I do not know if it is hidden or what. If you double click a android device in AVD manager it will show you the path of the "running avd" which is exactly where everyone says it should be. Since I could not delete these files using the GUI I used CLI (terminal to do so). You can utilize the following commands [cd] for changing directory [rm -R] to remove a file. Step by step:

  1. from terminal cli which will look something like this:

    nameOfYourMac:~ MacUser$

  2. type

    cd .android/avd

(directory changes)

nameOfYourMac:avd MacUser$ 3. Type

rm -R nameOfYourVirtualDevice.avd

Pretty easy. Now you should be able to delete the device in Eclipses' AVD Manager.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionwhatswrongView Question on Stackoverflow
Solution 1 - AndroidUttamView Answer on Stackoverflow
Solution 2 - AndroidjaroView Answer on Stackoverflow
Solution 3 - AndroidJonny WhiteView Answer on Stackoverflow
Solution 4 - AndroidQuentin DOMMERCView Answer on Stackoverflow
Solution 5 - AndroidZeeshanView Answer on Stackoverflow
Solution 6 - Androiduser2506891View Answer on Stackoverflow