我试图通过使用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.

当前回答

如果你使用的是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上测试的。

其他回答

这条消息意味着' simulator -x86'或'emulator64-x86'程序从$SDK/tools/中丢失,或由于某种原因无法找到。

首先,你确定你有一个有效的SDK下载/安装?

在WINDOWS上——更新系统路径对我来说很有用。为sdk的位置创建一个环境变量ANDROID_SDK,然后将它们添加到你的路径中,顺序如下:

%ANDROID_SDK%\emulator
%ANDROID_SDK%\platform-tools
%ANDROID_SDK%\tools
%ANDROID_SDK%\tools\bin

你不能启动模拟器-x86目录,因为它需要有LD_LIBRARY_PATH设置专门找到PC Bios和GPU仿真库(这就是为什么'模拟器'存在,它修改路径,然后调用模拟器-x86)。

你更新了第一个输出吗?看起来'emulator'仍然找到' /usr/local/bin/emulator-x86'

下面是启动模拟器-x86的方法:

cd $SDK/tools; 
ln -s emulator64-x86 emulator-x86

或者在Windows上打开命令提示符(Admin)

cd %ANDROID_SDK_ROOT%\tools
mklink emulator64-x86.exe emulator-x86.exe

现在模拟器将从SDK管理器启动。

注意:在最近的版本中,模拟器位于模拟器文件夹中。

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

cd $android_home/emulator and run emulator

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

alias emulator="$ANDROID_HOME/emulator/emulator"