简体   繁体   English

无法从 Android Studio 中的 AVD 管理器中删除 AVD

[英]Can't Delete AVD from AVD Manager in Android Studio

I am running Android Studio on OS X Yosemite.我在 OS X Yosemite 上运行 Android Studio。 I am trying to simply delete an AVD from Android Studio AVD Manager.我想简单地从 Android Studio AVD Manager 中删除一个 AVD。 Every time I attempt to delete it I get the message "The selected AVD is currently running in the Emulator. Please exit the emulator instance and try deleting again."每次我尝试删除它时,我都会收到消息“所选 AVD 当前正在模拟器中运行。请退出模拟器实例并再次尝试删除。” The problem is that the emulator is NOT running.问题是模拟器没有运行。 I even closed down all the studio and rebooted the computer.我什至关闭了所有工作室并重新启动了计算机。 It still says the same thing.它仍然说同样的话。 Anybody seen this before?有人见过这个吗? I would really like to remove the AVD.我真的很想删除 AVD。

Thanks in Advance!提前致谢!

Search for *.lock folders under .android folder and delete those..android文件夹下搜索*.lock文件夹并删除它们。 This should tell Android studio that the AVD is not running.这应该告诉 Android Studio AVD 没有运行。

To delete any android emulators (and thereby stop them, if they have been running in the background of the system) close Android Studio and go to the following folder:要删除任何 android 模拟器(并因此停止它们,如果它们一直在系统后台运行)关闭 Android Studio 并转到以下文件夹:

%userprofile%\.android\avd

(e.g. C:\user\username\.android\avd )

Delete all the files and folders inside it and restart the IDE.删除其中的所有文件和文件夹,然后重新启动 IDE。

Now when you open the Android Studio Device Manager it will ask you to create a new AVD.现在,当您打开 Android Studio 设备管理器时,它会要求您创建一个新的 AVD。

在 Android Studio 上,转到:Tool > Android > AVD Manager,在操作列上,您可以删除您的 avd

For Linux users:对于 Linux 用户:

Go to the .android folder (it should be in your home folder, ctrl + h to show hidden files), go to the avd folder ( cd ~/.android/avd from the command line).转到.android文件夹(它应该在您的主文件夹中, ctrl + h显示隐藏文件),转到avd文件夹( cd ~/.android/avd从命令行)。 Delete whichever avd you want to.删除您想要的任何avd。 Then restart Android Studio.然后重启 Android Studio。

In Linux/*nix and OSX:在 Linux/*nix 和 OSX 中:

Find the .android folder in your $HOME directory.在 $HOME 目录中找到 .android 文件夹。

1) In .android there should be a avd folder 2) In the avd folder should be one or multiple .ini file and a corresponding *.avd virtual device folder. 1) .android 中应该有一个 avd 文件夹 2) avd 文件夹中应该有一个或多个 .ini 文件和一个对应的 *.avd 虚拟设备文件夹。 3) Delete both the .ini file and the .avd folder you want to get rid of. 3) 删除您要删除的 .ini 文件和 .avd 文件夹。 4) Return to the Android sdk and AVD manager. 4) 返回 Android sdk 和 AVD 管理器。

I had an issue were I couldn't delete the files in the folder located at:我有一个问题是我无法删除位于以下文件夹中的文件:

C:\Users[your_comp_name_goes_here].android\avd[your_emulator_device]\hardware-qemu.ini.lock C:\Users[your_comp_name_goes_here].android\avd[your_emulator_device]\hardware-qemu.ini.lock

You cannot delete this file even if you close AndroidStudio and some other bug sending programs that didn't even close after you close AndroidStudio即使您关闭 AndroidStudio 和其他一些在您关闭 AndroidStudio 后甚至没有关闭的错误发送程序,您也无法删除此文件

There is a file called 'pid' inside the hardware-qemu.ini.lock folder that you can open up with notepad and it gives you the number of the process number. hardware-qemu.ini.lock 文件夹中有一个名为“pid”的文件,您可以使用记事本打开它,它会为您提供进程号。 Go into task manager>Details tab>order by PID by clicking on the columb>search for the PID>end process;进入任务管理器>详细信息选项卡>通过单击列按PID排序>搜索PID>结束进程; The process name should be something like quemu?????.exe I think.进程名称应该类似于 quemu?????.exe 我认为。

After that, your AndroidStudio will no longer be locked.之后,您的 AndroidStudio 将不再被锁定。 Maybe you could of solved it with a restart too.也许您也可以通过重新启动来解决它。

MAC USERS MAC用户

Steps脚步

1. Go to AVD Device Directory 1. 进入 AVD 设备目录

$ cd ~/.android/avd/<Device_Name>.avd

2. Delete *.lock files 2.删除*.lock文件

$ rm *.lock


Example例子

$ cd ~/.android/avd/Pixel_5_API_31.avd
$ rm *.lock

For those asking about the location of .android folder.对于那些询问 .android 文件夹位置的人。 I found mine at this path我在这条路上找到了我的

C:\Users\<Your_UserName>\ .android C:\Users\<Your_UserName>\.android

then you will find an avd folder.然后你会找到一个avd文件夹。 This folder contain the *.lock files StoneBird talked about.此文件夹包含 StoneBird 谈到的 *.lock 文件。

使用命令行,首先列出所有 avd,然后使用 avd 名称删除,例如:

avdmanager -v list

avdmanager -v delete avd -n "android-26"

A lot of people are perhaps not able to locate the '.android' folder easily.很多人可能无法轻松找到“.android”文件夹。 The easiest way to detect this folder and in turn the avd location is to click on the dropdown button next to the avd listing for each indiviual avd item in AVD Manager in android studio and selecting the "show on disk" option检测此文件夹和 avd 位置的最简单方法是在 android studio 中的 AVD Manager 中单击每个单独 avd 项目的 avd 列表旁边的下拉按钮,然后选择“在磁盘上显示”选项

Find the process查找过程

ps -eaf | grep avd

Kill it杀了它

kill -9 <process id>

窗口打开时单击 avd 管理器图标,单击它时会出现下拉箭头,将打开一个下拉菜单,单击选项查看系统文件现在左键单击文件单击数据,然后删除 pidgin 文件。

转到 AVD 管理器并选择要删除的模拟器,然后按 OK 了解更多信息https://developer.android.com/studio/run/managing-avds

在 Android Studio 上,转到:Tool > Android > AVD Manager,在操作列上,您应该单击“停止”,然后您可以删除该设备

Currently in AVD Manager it's also possible just to click Stop and will do it for you.目前在 AVD Manager 中,也可以单击Stop并为您完成。

Then you just play the emulator again.然后你再次玩模拟器。

在此处输入图像描述

if you are using linux distro如果您使用的是 linux 发行版

aseztak@kalyan:~$ top

find adb pid找到adb pid

Then you kill the PID you found (replace 1334 with the PID you found):然后你杀死你找到的 PID(用你找到的 PID 替换 1334):

aseztak@kalyan:~$ kill 1334

Recent versions of Android Studio on windows may place the avd folder in your C: directly. Windows 上最新版本的 Android Studio 可能会将 avd 文件夹直接放在您的 C: 中。

C:\Android\.android

You can look for avd folder in here if you can't find it in the home directory,如果您在主目录中找不到 avd 文件夹,您可以在此处查找它,

C:\Users\%USERNAME%\.android

( Yea, you can directly paste this in the address bar, windows understands. ) 是的,你可以直接在地址栏中粘贴这个,windows可以理解。

After getting to the avd folder, as others have said, delete the *.lock folders or delete the folder with the name of avd which is causing issues, refresh the avd manager using the refresh button at the bottom right and then delete the avd from the avd manager.进入 avd 文件夹后,正如其他人所说,删除 *.lock 文件夹或删除导致问题的名称为 avd 的文件夹,使用右下角的刷新按钮刷新 avd 管理器,然后从avd 经理。

The issue is Android Studio didn't pick the command and shows xx Device is running in the background.问题是 Android Studio 没有选择命令并显示 xx 设备正在后台运行。 The only solution is to delete the Emulator manually.唯一的解决方案是手动删除模拟器。

  1. Select tools from the upper options of Android studio, select the SDK Manager, and delete the emulator from there.从 Android Studio 的上方选项中选择工具,选择 SDK Manager,然后从那里删除模拟器。 It will work for sure.它肯定会起作用。

  2. After deleting from SDK Manager, now delete the Emulator from Device Manager and it will get vanished in matter of seconds.从 SDK 管理器中删除后,现在从设备管理器中删除模拟器,它将在几秒钟内消失。

for mac users- go to this folder - and delete the specific device file -对于 mac 用户 - go 到此文件夹 - 并删除特定的设备文件 -

to show hidden files use this - ctrl + shift +.要显示隐藏文件,请使用 - ctrl + shift +。

I had to close Android Studio and then restart it.我不得不关闭 Android Studio 然后重新启动它。 The dialog box saying to delete the "multiinstance.lock" file couldn't be done because it was locked down.提示删除“multiinstance.lock”文件的对话框无法执行,因为它已被锁定。

If you're not founding the .android you can restart your computer and the emulator will stop.如果您没有创建 .android,您可以重新启动计算机,模拟器将停止。 So you can delete the AVD :)所以你可以删除 AVD :)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM