141

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.

5
  • 1
    How are you trying to delete ?? Nov 2, 2011 at 10:24
  • I am able to delete and add from Eclipse comfortably. Let me know how are u trying to delete it. Nov 2, 2011 at 10:26
  • If emulator is running and if you are trying to delete the currently running emulator it won`t delete. Before you going to delete Virtual device please close all running emulator
    – Karthi
    Nov 2, 2011 at 10:41
  • 2
    Emulator is not running as I mentioned, at least I didn't run it. I am trying to remove it from Eclipse AVD Manager! It is platform 4.0. I specially restarted Ubuntu to kill all processes, because I didn't find any.. Seems it's only the problem of Android 4.0 platform.
    – whatswrong
    Nov 2, 2011 at 12:16
  • Same issue for Android Studio at the moment.
    – Jono
    Sep 13, 2014 at 18:36

6 Answers 6

290

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.
5
  • 40
    Works the same for OSX. In terminal Go to ~/.android/avd/ then delete the <avd name>.ini and <avd name>.avd files. When you refresh the list in the Android Virtual Devices window the ADV will be gone.
    – JosephL
    Jan 31, 2012 at 3:18
  • 3
    and I bet it also works for windows. Guess the structure of android's SDK is everywhere the same :) just a matter of paths.
    – nuala
    Apr 3, 2012 at 15:06
  • Thanks JosephL . Can you please explain , the path it shows if we double click our .avd I created can only be navigate through terminal. But if I try to go through finder->/Users/home/ I caanot see /.android/avd . why is that ?
    – May
    Jul 23, 2013 at 19:29
  • If you look in the ~/.android/avd/<avd-name>.avd directory, you will see several files with the .lock extension. You can delete those and then you will be able to use the virtual device manager app.
    – BJV
    Mar 31, 2014 at 15:09
  • If when you try to return to the AVD manageryou get an error saying something like the SDK location has not been set, give the workspace time to load. I followed the above and got this message, it took a while to figure out I was just jumping too quickly to back to the AVD
    – nPn
    Apr 27, 2014 at 15:00
25

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.

1
  • The original reason why I tried to delete was that I was not able to start it, with a very non-explanatory error. So, to me, this is the best answer.
    – shalafi
    Jan 7, 2014 at 13:22
19

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.

6

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;
2
  • with htop, you can search with f3 search something like emulator :) Nov 3, 2011 at 9:11
  • The even more interesting code snippet would be the one showing how avdInfo.isRunning() is decided. (It probably shows that the avd folder is scanned for *.lock files.)
    – Risadinha
    Jul 16, 2013 at 11:15
2

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

0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.