在更新到Android Studio 2后,当我试图运行我的应用程序并选择一个模拟器时,我等待模拟器启动,它突然被杀死。我可以看到模拟器进程几分钟,但从来没有GUI。在Android studio中,我得到了错误

android studio Error while waiting for the device: The emulator process for AVD was killed

即使我在Android Studio之外运行模拟器也会发生这种情况。我试用了Android 6和基于Android 4.4的模拟器。 在Windows 7 x64 PC上运行。类似于另一个StackOverflow帖子被关闭。我尝试了各种ram、VM堆和分辨率设置。


当前回答

我的案例是:谷歌PLAY。

我的虚拟设备是Pixel 4…… 如图所示,Pixel4有谷歌播放支持,因此它会给出这样的错误:“AVD Pixel4的模拟器进程已被杀死。” 它在Android Studio 4.1.1上给出错误。 因此,我创建了一个新的虚拟设备(Pixel 4XL),并选择“SOFTWARE”来模拟性能…… 因为这个设备没有谷歌播放支持,所以它对我来说是有效的。

其他回答

解决此错误的最佳5个选项,avd的模拟器进程被杀死

given option are checkpoints, check it out one by one.
Error Solution Option 1
Possiblity:
HAXM may not installed in System
HAXM - Hardware Accelerated Execution Manager
Solution:
SDK Manager > Check for HAXM installer
install it, if HAXM not installed
=======================================

Error Solution Option 2
Possiblity : 
Low disk size to load Emulator
Latest AVD with API level 30+ required approx 7 GB disk space
Solution:
Free space from disk where AVD is located

=======================================
Error Solution Option 3
Possiblity :
Configured AVD API may not available in SDK Manager
As an Example:
if Emulator with API level 30, same package of API 30 should be installed in SDK

Solution:
Install same version of SDK Platfrom from SDK manager,
as same as Emulator – AVD API

=======================================
Error Solution Option 4
Possiblity :
Configuration error in Old AVD 

Solution:
Recreate AVD with latest available update
Help > check for update, if component Android Emulator Update is available, install it
delete older AVD and create Fresh AVD

=======================================
Error Solution Option 5
Possiblity :
Embedded AVD not properly load with available image

Solution:
Launch AVD as independent component,
After success close it and lauch within Android Studio
Emulator inside Android Studio
=======================================

before apply all of above once restart you System, try it.

有关视频支持的更多帮助,请参阅如何修复AVD被杀死 我想它可能对你有帮助。

以我为例,在安装了Microsoft Visual c++ Redistributable for Visual Studio 2015、2017和2019 (x86和x64版本)后,问题就解决了。

但是等等!我怎么会知道?我将告诉你我的经历。

当您的程序遇到错误时,您需要做的第一件事是找到要调试的日志。但是记录Android模拟器所有事件的日志文件在哪里?单击帮助→显示登录资源管理器。然后打开一个新窗口,其中有一个名为idea.log的文件,这个日志文件就是我们要找的。

但是这个文件可能记录了太多的详细信息,所以让我们执行以下过程来获得一个更简单的信息:

·退出Android Studio

·删除idea.log

·开放Android Studio

·点击工具→AVD管理器

·启动一个你已经创建的模拟器,不用说,错误将再次发生。但是现在将创建idea.log,并将错误记录到日志文件中!

·退出Android Studio。

·打开idea.log并开始分析它。

·搜索“模拟器”,在我的情况下,有2条消息吸引了我的眼球:

INFO - manager.EmulatorProcessHandler - Emulator: E:\cache\SDK\emulator\emulator.exe -netdelay none -netspeed full -avd Nexus_5_API_22 

INFO - manager.EmulatorProcessHandler - Emulator: Process finished with exit code -1073741515 (0xC0000135)

显然,“退出码1073741515”很重要,实际上很多人都问过它在StackOverFlow中是什么意思,但不幸的是,我找不到关于它的任何有用信息。所以让我们传递它,专注于第一条信息。

打开命令行(按“Win”+“R”→进入“CMD”→单击“确定”),复制上述消息E:\cache\SDK\emulator\emulator.exe -netdelay none -netspeed full -avd Nexus_5_API_22 并将其粘贴到命令行。按回车。

我完全不知道这个命令是什么意思,但是可以合理地推断Android Studio运行了这个命令并导致了错误,所以我将尝试重现这个问题。

之后,弹出一个错误窗口,提示“…VCRUNTIME140_1.dll丢失…”。我知道我已经接近答案了。所以我在谷歌上搜索“VCRUNTIME140_1.dll Missing”,人们说“下载并安装Microsoft Visual c++ 2015 - 2019 Redistributable的x86和x64版本将解决这个问题”。

所以我下载了x86和x64版本并安装它们。完成此操作后,再次运行模拟器,一切正常。

转到C:\Users\{{USERNAME}}\。android\avd,删除avd目标设备的文件夹,并在avd管理器中创建一个新的虚拟设备。现在单击运行按钮。就是这样

我最近在我的Mac 10.14.6 Mojave上遇到了这个问题,错误与gokhhan -arik https://stackoverflow.com/a/66422209/15311922中的一个答案中的错误完全相同。

在他的案例中,他通过更新到11.2.1 Big Sur解决了这个问题。 我的解决方法不同。

从终端运行: /Users/<username>/Library/Android/sdk/emulator/emulator emulator -avd <Pixel_4_API_29> .

我的错误信息:


dyld: Library not loaded: /System/Library/Frameworks/IOUSBHost.framework/Versions/A/IOUSBHost

  Referenced from: /Users/<username>/Library/Android/sdk/emulator/qemu/darwin-x86_64/qemu-system-x86_64

  Reason: image not found

Abort trap: 6

我设法从我朋友的笔记本电脑上获得IOUSBHost.framework,然后将其上传到谷歌驱动器(zip格式),然后执行以下步骤:

重启mac并命令+R显示恢复选项,选择Safari图标以恢复模式启动Safari 在safari中,打开我之前上传的谷歌驱动器链接,然后直接将zip文件下载到/System/Library/Frameworks/(它会自动解压缩) 重启笔记本电脑。

现在,你可以使用模拟器无需更新到大苏尔。

这里是IOUSBHost.framework.zip。使用它的风险由你自己承担。https://drive.google.com/file/d/1ZP6rfMf-iW3j8iOGQC52zIHZcs4Haid1/view?usp=sharing

对我来说,从环境变量列表中删除ANDROID_SDK_HOME就解决了这个问题