我试图通过使用AVD管理器运行一个Android模拟器。 这是我的avd: http://image-upload.de/image/fnx79V/52b0d050ee.png

这就是开始时的情况:

http://image-upload.de/image/vGpQfa/e912d83939.png

我有一台Macbook Pro Retina。直接从intel页面安装Haxm驱动程序。

没有模拟器在工作。都得到相同的“错误”消息。

运行命令(此错误是当我使用Homebrew安装Android-sdk和Android-platform-tools |时,任何得到相同问题的人都应该删除此或查看冲突的位置)

export ANDROID_EMULATOR_DEBUG=1 test20

emulator:Found AVD name 'test20'
emulator:Found AVD target architecture: x86
emulator:Looking for emulator-x86 to emulate 'x86' CPU
emulator:Probing program: ./emulator-x86
emulator:Probing path for: emulator-x86
emulator:Found target-specific emulator binary: /usr/local/bin/emulator-x86
emulator:Probing for: /usr/local/bin/libOpenglRender.dylib
emulator:Probing for: /usr/local/bin/lib/libOpenglRender.dylib
emulator:Probing for: /usr/local/lib/libOpenglRender.dylib
emulator:Probing for: /usr/local/bin/lib64OpenglRender.dylib
emulator:Probing for: /usr/local/bin/lib/lib64OpenglRender.dylib
emulator:Probing for: /usr/local/lib/lib64OpenglRender.dylib
emulator:Could not find OpenGLES emulation host libraries!
emulator: ERROR: This AVD's configuration is missing a kernel file!!

emulator -avd test21
emulator:Found AVD name 'test21'
emulator:Found AVD target architecture: x86_64
emulator:Looking for emulator backend for x86_64 CPU
emulator:Probing program: ./emulator-x86_64
emulator:Probing path for: emulator-x86_64
emulator:Looking for emulator-x86 to emulate 'x86_64' CPU
emulator:Probing program: ./emulator-x86
emulator:Probing path for: emulator-x86
PANIC: Missing emulator engine program for 'x86_64' CPUS.

在我解决了Homebrew的问题后:

我试了一下,发现了这个:

emulator64-x86 -avd test20
Creating filesystem with parameters:
    Size: 69206016
    Block size: 4096
    Blocks per group: 32768
    Inodes per group: 4224
    Inode size: 256
    Journal blocks: 1024
    Label: 
    Blocks: 16896
    Block groups: 1
    Reserved block group size: 7
Created filesystem with 11/4224 inodes and 1302/16896 blocks
emulator: ERROR: Could not load OpenGLES emulation library: dlopen(lib64OpenglRender.dylib, 1): image not found
emulator: WARNING: Could not initialize OpenglES emulation, using software renderer.
HAX is working and emulator runs in fast virt mode
qemu: could not load PC BIOS 'bios.bin'

对于所有有同样问题的人来说,这些步骤可能会有所帮助:

在调试模式下运行模拟器:

export ANDROID_EMULATOR_DEBUG=1 emulatorName

如果有一个路径看起来奇怪,检查其他安装,如Homebrew,并删除冲突(卸载一个)

当库丢失时,你需要导出变量:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ANDROID_HOME/tools/lib

当错误“qemu: could not load PC BIOS ' BIOS .bin'”出现时,一个修复方法是使用完整路径运行模拟器:

/Applications/Android\ Studio.app/sdk/tools/emulator64-x86 -avd test20
In your case it is maybe a other path.

当前回答

我遇到了同样的问题,从来没有为我工作,除非去到模拟器文件夹,我尝试导出模拟器文件夹,但不为我工作

cd $android_home/emulator and run emulator

,最后,我在.bashrc文件中编写了Elias命令

alias emulator="$ANDROID_HOME/emulator/emulator"

其他回答

这个问题源于SDK的变化,因为模拟器现在有自己的目录。 我没有注意到(也不在乎)运行一个过时的模拟器,尽管它仍然可以工作… 这是一个停滞的SDK迁移。使用-verbose开关运行时:

emulator -avd Nexus_6_API_R -verbose

人们可以看到它开始恐慌的地方:

emulator:try dir C:\Android\tools
emulator:Looking for emulator-x86 to emulate 'x86' CPU
emulator:Probing program: C:\Android\tools/emulator-x86.exe
PANIC: Missing emulator engine program for 'x86' CPU.

但是没有可用的模拟器-x86.exe,实际的模拟器驻留在目录emulator中。在卸载“SDK Tools”(同时尝试重新安装它们)后,该条目意外地从列表中消失,留下一个空的工具目录,可以从PATH中删除和删除。

不需要也不建议使用x86_64仿真(因为这将运行已停止的仿真器版本)。通过卸载“SDK工具”来适应SDK路径的变化是“答案”。人们可能只是用PATH上的模拟器替换工具,但这留下了混乱。


作为比较,30.3.5.0版本的实际启动顺序应该是这样的:

emulator: Android emulator version 30.3.5.0 (build_id 7033400) (CL:N/A)
emulator: Found AVD name 'Nexus_6_API_R'
emulator: Found AVD target architecture: arm
emulator: argv[0]: 'emulator.exe'; program directory: 'C:\Android\emulator'

如果后续可能出现类似的错误:

PANIC: Broken AVD system path. Check your ANDROID_SDK_ROOT value

这意味着*.ini文件中的系统映像路径可能是错误的。它有助于下载x86系统映像,然后创建一个新的模拟器。

如果你使用的是macOS,将Android SDK模拟器和tools目录都添加到路径中:

步骤1:在我的例子中,顺序很重要,首先是模拟器,然后是工具。

export ANDROID_SDK=$HOME/Library/Android/sdk
export PATH=$ANDROID_SDK/emulator:$ANDROID_SDK/tools:$PATH

步骤2:根据操作系统重新加载.bash_profile或.bashrc

步骤3:获取可用的模拟器列表: 模拟器-list-avds美元

步骤4:从命令行启动模拟器,并将avd替换为模拟器的名称$emulator @avd

别忘了加上@符号。

这是在macOS High Sierra 10.13.4和Android Studio 3.1.2上测试的。

这里的问题是由默认AVD在设置为“auto”时使用硬件加速GLES引起的。必须编辑AVD并将其设置为“软件- GLES 2.0”

在macOS Mojave 10.14.5上测试。

原因及解决方法:

我们使用sdk/tools/emulator,我们应该使用sdk/emulator。

WM-C02WM0T3HTD8:~ zgong$ emulator -avd Pixel_3_XL_API_Q_x86
PANIC: Unknown AVD name [Pixel_3_XL_API_Q_x86], use -list-avds to see valid list.
HOME is defined but there is no file Pixel_3_XL_API_Q_x86.ini in $HOME/.android/avd
(Note: Directories are searched in the order $ANDROID_AVD_HOME, $ANDROID_SDK_HOME/avd, and $HOME/.android/avd)
WM-C02WM0T3HTD8:~ zgong$ emulator -avd Pixel_3_XL_API_Q
PANIC: Missing emulator engine program for 'x86' CPU.

我们可以检查模拟器的位置:

WM-C02WM0T3HTD8:~ zgong$ which emulator
/Users/zgong/Library/Android/sdk/tools/emulator

我在谷歌上搜索了一下,大部分答案都是关于 在终端中正确设置路径,结果是 与SDK最新版本的转变有关,其中模拟器 App位于/emulator而不是/tools。把这个留在这里 Case也遇到了同样的问题。

我们需要使用如下:

{sdk location}/ avd -模拟器{avd}

以下是实际输出:

WM-C02WM0T3HTD8:~ zgong$ /Users/zgong/Library/Android/sdk/emulator/emulator -avd Pixel_3_XL_API_Q
pc_memory_init: above 4g size: 40000000
emulator: WARNING: UpdateCheck: Failure: Error
emulator: WARNING: UpdateCheck: failed to get the latest version, skipping check (current version '29.2.1-5889189')
emulator: WARNING: UpdateCheck: Failure: Error
WebSocketServer listening on port 55850
Qt WebEngine ICU data not found at /Users/joshuaduong/qt-build-5.12.1/install-darwin-x86_64/resources. Trying parent directory...
Qt WebEngine ICU data not found at /Users/joshuaduong/qt-build-5.12.1/install-darwin-x86_64/resources. Trying parent directory...
Qt WebEngine ICU data not found at /Users/joshuaduong/qt-build-5.12.1/install-darwin-x86_64. Trying application directory...
Qt WebEngine ICU data not found at /Users/joshuaduong/qt-build-5.12.1/install-darwin-x86_64. Trying application directory...
Installed Qt WebEngine locales directory not found at location /Users/joshuaduong/qt-build-5.12.1/install-darwin-x86_64/translations/qtwebengine_locales. Trying application directory...
Qt WebEngine locales directory not found at location /Users/zgong/Library/Android/sdk/emulator/lib64/qt/libexec/qtwebengine_locales. Trying fallback directory... Translations MAY NOT not be correct.
Installed Qt WebEngine locales directory not found at location /Users/joshuaduong/qt-build-5.12.1/install-darwin-x86_64/translations/qtwebengine_locales. Trying application directory...
Qt WebEngine locales directory not found at location /Users/zgong/Library/Android/sdk/emulator/lib64/qt/libexec/qtwebengine_locales. Trying fallback directory... Translations MAY NOT not be correct.
Path override failed for key ui::DIR_LOCALES and path '/Users/zgong/.QtWebEngineProcess'
Path override failed for key ui::DIR_LOCALES and path '/Users/zgong/.QtWebEngineProcess'
Qt WebEngine resources not found at /Users/joshuaduong/qt-build-5.12.1/install-darwin-x86_64/resources. Trying parent directory...
Qt WebEngine resources not found at /Users/joshuaduong/qt-build-5.12.1/install-darwin-x86_64. Trying application directory...
Qt WebEngine resources not found at /Users/joshuaduong/qt-build-5.12.1/install-darwin-x86_64/resources. Trying parent directory...
Qt WebEngine resources not found at /Users/joshuaduong/qt-build-5.12.1/install-darwin-x86_64. Trying application directory...
[0403/154905.171893:WARNING:resource_bundle_qt.cpp(116)] locale_file_path.empty() for locale
[0403/154905.171871:WARNING:resource_bundle_qt.cpp(116)] locale_file_path.empty() for locale
Qt WebEngine ICU data not found at /Users/joshuaduong/qt-build-5.12.1/install-darwin-x86_64/resources. Trying parent directory...
Qt WebEngine ICU data not found at /Users/joshuaduong/qt-build-5.12.1/install-darwin-x86_64. Trying application directory...
Installed Qt WebEngine locales directory not found at location /Users/joshuaduong/qt-build-5.12.1/install-darwin-x86_64/translations/qtwebengine_locales. Trying application directory...
Qt WebEngine locales directory not found at location /Users/zgong/Library/Android/sdk/emulator/lib64/qt/libexec/qtwebengine_locales. Trying fallback directory... Translations MAY NOT not be correct.
Path override failed for key ui::DIR_LOCALES and path '/Users/zgong/.QtWebEngineProcess'
Qt WebEngine resources not found at /Users/joshuaduong/qt-build-5.12.1/install-darwin-x86_64/resources. Trying parent directory...
Qt WebEngine resources not found at /Users/joshuaduong/qt-build-5.12.1/install-darwin-x86_64. Trying application directory...
[0403/154907.393116:WARNING:resource_bundle_qt.cpp(116)] locale_file_path.empty() for locale

参考: https://www.reddit.com/r/androiddev/comments/a978kx/mac_can_run_emulator_fine_through_android_studio/

我的问题是在VS Code中使用集成终端。这显示了一个不同的路径设置(因此工具路径而不是模拟器路径首先显示)。你所需要的只是使用正确的bash更改全局vscode设置,如下所示:https://stackoverflow.com/a/53971796/3437868