Can't delete virtual device from Eclipse, android - android

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.

In Linux/*nix and OSX:
Find the .android folder in your $HOME directory.
In .android there should be a avd folder
In the avd folder should be one or multiple .ini file and a corresponding *.avd virtual device folder.
Delete both the *.ini file and the *.avd folder you want to get rid of.
Return to the Android sdk and AVD manager.

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.

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.

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;

From Finder(OSX)OR Directory Explorer(Linux & Windows)
Find the .android folder [Hidden Folder] in your $HOME directory. Show/Hide Folders on MAC
In .android there should be a [Your Device].avd folder
Find *.lock files and delete inside [Your Device].avd folder
From Android Studio
Open AVD Manager
Select virtual device that you want to delete
Click down arrow at the end and select [Show on Disk] it will open directory
Find *.lock files and delete inside [Your Device].avd folder
After these steps it will allow you to delete from AVD Manager

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:
from terminal cli which will look something like this:
nameOfYourMac:~ MacUser$
type
cd .android/avd
(directory changes)
nameOfYourMac:avd MacUser$
Type
rm -R nameOfYourVirtualDevice.avd
Pretty easy. Now you should be able to delete the device in Eclipses' AVD Manager.

Related

Is this Android Studio bug or am I doing wrong?

I have android studio setup on my Ubuntu machine and now whenever I try to start the emulator, it throws exception like:
Cannot launch AVD in emulator.
Output:
PANIC: Could not find
Nexus_S_API_21.ini file in $ANDROID_AVD_HOME$ nor in $HOME./android/avd
So when I do:
echo $ANDROID_AVD_HOME
It shows empty which means that this path is not set and when $HOME is my /home/user
So when I go in /home/user/.android/avd there is really no .ini file. So, I am confused, when I create a virtual device, where does it go? How can I find the path where virtual devices are being created and if possible, how can I change the path to create virtual devices?
You can find location of your avd's *.ini files in AVD Manager (GUI).
Right under tab "Android Virtual Devices" there is line "List of existing Android Virtual Devices located at %here is the location%".
You can try to change system variable %android_avd_home% to something like /home/user, for example and then restart IDE (Android Studio).
Also, you can try to find useful information here: https://code.google.com/p/android/issues/detail?id=78577
Hope it helps
I experienced this same issue on OSX, but the weird part was it only happened after I had added the ANDROID_SDK_HOME varible to my environment.
I experimented and found that if I added the ANDROID_AVD_HOME variable to my environment or I removed ANDROID_SDK_HOME, it caused it to start working.
One solution at this problem is to copy the file's emulator which exited and rename it in the name of the new emulator; that is say the android studio name of emulator who is try to run.
NB : Before I suppose you had install the eclipse ADT which contains one or some emulator
Example :
1) cd .android/avd/
2) ls -al
3) cp .ini .ini
4) Finish run the emulator in your android studio by the AVD
This happens on Windows when the user home folder is changed from the default one. To make Android Studio happy just add a system enviroment variable and set it to your home folder, for example:
ANDROID_SDK_HOME = D:\Users\max\

AVD - PANIC: Could not open... - not a path issue

I want to write an Android app and I've started this morning by loading JDK, eclipse, SDK etc, all from the adt-bundle-windows-x86_64-20130219 from http://developer.android.com.
The issue for me right now:
[2013-02-27 13:36:26 - Test2] Android Launch!
[2013-02-27 13:36:26 - Test2] adb is running normally.
[2013-02-27 13:36:26 - Test2] Performing com.example.test2.MainActivity activity launch
[2013-02-27 13:37:27 - Test2] Launching a new emulator with Virtual Device 'droidX2'
[2013-02-27 13:37:27 - Emulator] PANIC: Could not open: droidX2
I've been sifting though posts on the web all morning about AVD and I haven't seen one that didn't involve the path being messed up and the .ini not found. I don't think I've got a path issue. AVD is looking for files on D:\USERS\XXX\.android\avd and that's where the files are. So don't understand why the emulator can't open.
I've done the most basic things like remove and re-install everything, read the notes at orace etc. Basically I'm stuck. Any suggestions here?
adt-bundle-windows-x86_64-20130219 was what I loaded on Windows 7 (32bit).
I'd settle for testing on the mobile that's connected to the PC but I can't get that to work either!
Any direction appreciated.
This has been asked a few times already, try these:
Create a environment variable called: ANDROID_SDK_HOME and set it to
C:\Users\Administrator Open Eclipse > Window > Preferences and click
in Run/Debug and String Substitution Add a new variable called:
user.home and set it to C:\Users\Administrator Create an AVD and run
it.
Original answer by Colin
an android project member says here:
As a work-around, you can define the environment variable
ANDROID_SDK_HOME to point to the directory containing your .android
directory. The emulator and SDK Manager will pick it up properly.
verify that The location in which the avd was searched from is different from where it is actually created. Take a look at the screenshot below for more information.
ANOTHER OPTION: Symlinking...
In a command prompt (with admin privileges), change directory ("cd") to "C:\Users\YourUserName.android" and then use the following command to create a symlink to the avd directory (notice the direction of the slashes):
mklink /D avd D:\_MyLibrariesDir\.android\avd
Where "_MyLibrariesDir" is the directory that your libraries (photos, documents, etc) folders are located.
And you're done!
Explanation: This has the same effect as the ANDROID_SDK_HOME option except that you can now browse to [C:\Users\YourUserName\.android\avd\*] and [D:_MyLibrariesDir\.android\avd\*] and both will take you to the same spot.
This differs from a shortcut in that shortcuts do not act as directories, so if you just had a shortcut to the "avd" folder, you could not go to "C:\Users\YourUserName\.android\avd*" as it would produce a file not found error and if you tried to click on an avd shortcut file it would take you to [D:_MyLibrariesDir\.android\avd\*] instead of keeping you on the C drive. Symlinks act a bridge between locations in a way that is transparent to user and software. Quite handy :)
I fixed the AVD Panic issue by running Eclipse as an administrator.
On Ubuntu check the current user if you run eclipse as root (sudo) eclipse could NOT find the /root/.android set the user home
user.home /home/<user>/
and copy the AVD files into the new directory than changes the privileges
cd /home/<user>/
chgrp <user> -R .android
chgrp <user> -R .android
Simply if nothing works for you, just copy the folder avd which you could find in your .android folder to C:\Users\<user name>\.android.
Pls check once in Ur ".android" folder, another/duplicate ".android" folder might have been created. If "YES" is Ur answer then do this thing because in my case that thing was happened.
Simply I just kept only the latest ".android" folder in this directory "C:\Users\USER NAME\" (removed the duplicated one) and then emulator started working for me.
Cheers
try to add new windows admin user with English language only
it worked for me
the user name should be in English letters
Found a simple way to make it work - worth trying:
1. If you do not have it yet - create a new AVD with the problematic name (in this case droidX2) if you see an overwrite warning - overwrite it.
2. Delete the new AVD you just created in step 1.
3. If you have another AVD it's OK, if not - create one.
4. Retry running the Eclipse project as an Android application - now it should run
Setting the ANDROID_SDK_HOME environment variable alone works fine for Win7 and earlier but did not help me on Win8.
For poor tortured souls using the piece of crap which is Windows 8, go to wherever you've installed the Android SDK (e.g. C:\SDK\Android or C:\Users\JoeCitizen\AppData\Local\Android\android-sdk) and make sure both AVD Manager.exe and SDK Manager.exe are set to run as Administrator for all users. Once I did that it worked fine.
Yet another deceptive problem-which-shouldn't-be-a-problem caused by the complete fail which is permission management circa Windows 8.
Using Windows 7, Eclipse, Android SDK tools 23.0.4
First time I followed the exact instruction on http://developer.android.com/training/index.html
I got the error "PANIC: could not open.." whenever 'Start' emulator.
Solution: System property popup/Enviroment Variables/ System variables, Added new entry
name="ANDROID_SDK_HOME", value = "D:\DATA\Users\ThisUser\"
Then it starts work!
"D:\DATA\Users\ThisUser\" is parent folder where ".android/avd" folder exists.
avd folder path here is "D:\DATA\Users\ThisUser.android\avd"
Note that you must put "D:\DATA\Users\ThisUser\", not "D:\DATA\Users\ThisUser**.android**"

Android AVD + Eclipse: How to remove a directory from Android File Explorer?

I'm using eclipse to run developing apk.
I can delete file that apk created into from mnt/sdcard-
But i'm not able to delete create folders. The red minus icon is grayed and disabled when I click on a folder, but it's enabled and red when i click on a file.
So, how to delete a folder ?
I cannot destroy sdcard every time, i'm downloading a very complex folder structure
You can connect to the Android Emulator instance via adb. This allows you to delete files and folder via command-line.
Just execute adb shell rm -r /mnt/sdcard/yourfoldername

How to change default list path of AVD manager in linux?

I do read relevant topics before asking the question, but none is helpful.
I am using Ubuntu 12.04, the default path of AVD is ~/.android/avd, and I would like to change it, how can I make it?
Thanks for reply.
You can use a symbolic link to change the default path of AVD in Linux.
mv ~/.android/avd ~/.android/avd_bak #take backup of existing images in case you need them
ln -s path/to/my/avd ~/.android/avd
Now whenever you create a new image they will actually be created in the new location. For moving the existing images to the new folder you can follow the steps mentioned in Rajesh's answer
From Android Developer Guide Managing AVDs from the Command Line where the following is stated:
Default location of AVD files
When you create an AVD, the android tool creates a dedicated directory for it on your development computer. The directory contains the AVD configuration file, the user data image and SD card image (if available), and any other files associated with the device. Note that the directory does not contain a system image — instead, the AVD configuration file contains a mapping to the system image, which it loads when the AVD is launched.
The android tool also creates an <AVD_name>.ini file for the AVD at the root of the .android/avd/ directory on your computer. The file specifies the location of the AVD directory and always remains at the root the .android directory.
By default, the android tool creates the AVD directory inside ~/.android/avd/ (on Linux/Mac), C:\Documents and Settings\<user>\.android\ on Windows XP, and C:\Users\<user>\.android\ on Windows 7 and Vista. If you want to use a custom location for the AVD directory, you can do so by using the -p <path> option when you create the AVD:
android create avd -n my_android1.5 -t 2 -p path/to/my/avd
If the .android directory is hosted on a network drive, we recommend using the -p option to place the AVD directory in another location. The AVD's .ini file remains in the .android directory on the network drive, regardless of the location of the AVD directory.
It should be clear that new AVDs can be created on different location by using the -p <path> option. If you want to move the existing AVDs, you should edit the corresponding .ini files and alter the path= attribute, while making sure that you leave the .ini files in the ~/.android/avd directory. (Just to be safe, make sure you take a backup of the .ini files before you tamper with them)
"I guess not, because the Android SDK & tools do not use any system registry/configuration values."
Also there doesn't seem to be a setting available to enter the path. What a disgrace. It is a disgrace because it is hard coded.
Quick-fix for those win 7 users who were so adventures that upgraded to a colour monitor as against the linux-standard green/amber screen and now dare to look down on command line:
From \Users\ directory copy the .android directory into the C:\Users\ directory.
Apart from the avd directory the rest can be deleted.
Inside the avd directory the yourdevice.avd directory is not necessary.
All you need is the .ini file.
There is also no need to modify the path inside the .ini file either. It points to the right location.
When you create a new device-profile, it is saved to the NORMAL path IE: as before:
\Users\.android\avd
Copy and paste the device's .ini file from \Users\.android\avd directory to the C:\Users\.android\avd directory.
I did some testing, it seems to work.
If there is a problem with this approach, please tell about it.
May I ask the Android SDK developers to do a search for "Microsoft Windows Operating System", for "Graphical User Interface" and for "hardcoding" as it relates to programming practices.

Error while launching android emulator

everybody,
I am facing a weird problem in mac osx. I have installed eclipse(Indigo 64 bit) on my mac machine with ADT r15. and android sdk with API level 7. everything works fine but when i create a virtual device and launch it, i always get error
PANIC: Could not open: /tmp/.android/avd/avd_2.1.ini`
The problem is that eclipse looks for avd at location /tmp/.android/avd/ but avd is actually located at /var/root/.android/avd.
Is there any workaround.
Thanks
N_JOY
In Windows you should add the environment variable, there's probably such a thing in Mac OS but i'm not really familiar with that..
check this: (number 5 is your goal)
http://fyi.oreilly.com/2009/02/setting-up-your-android-develo.html
This is just a patch but solved my problem. As eclipse is looking for avd inside tmp directory. so i have created .android/avd directory in tmp folder.
NOTE: you can't create any directory whose name starts with'.'. so you should create it from terminal.
and then copy original contents from /var/root/.android/avd to /tmp/.android/avd/
N_JOY.
I encountered the same problem but I was able to managed it though.
What I did is that I copied the contents of .android folder (from the root -- /var/root/.android) to the tmp (/tmp/.android).
Since in MAC OS you cannot create/open folder that name's start from a dot (e.g. -- .android folder), you have to do it manually using the terminal.
Even the folder is created by the AVD Manager, you will not be able to see it unless you do it manually in the terminal.
Usually what the AVD Manager does is that it creates a .android folder in the root and it doesn't care if you were able to see it. What is important to him is that he created it.
First you must create a device to the emulator then click 'Details' to make sure where it is located. Then open the .android folder in the Terminal (using the location you saw in the Details but usually it is in the /var/root/ directory).
Open Terminal, type open /var/root/.android
Second copy that directory to the tmp folder.
type cp -R var/root/.android /tmp
Restart Eclipse and Run the Device using the AVD Manager.
Now, the Device will be open.
NOTE: Since this is a temporary folder, you have to copy the contents of the .android folder in the tmp folder every time you open your MAC.
Seems this is related run the eclipse using root instead of normal user. You can also use symbol link:
ln -s /var/root/.android /tmp

Categories

Resources