我正在try 使用AVD管理器运行Android模拟器.

这就是开始时发生的事情:

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

我有一台Macbook Pro视网膜.直接从英特尔页面安装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.

在我用brew 软件解决问题后:

我试了一下发现:

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:无法加载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 emulatortools目录添加到路径:

Step 1:对我来说,顺序很重要,先是emulator,然后是tools.

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

Step 2:根据操作系统重新加载.bash_profile.bashrc

Step 3:获取可用的仿真器列表: $emulator -list-avds

Step 4:从命令行启动仿真器,并将avd替换为仿真器$emulator @avd的名称

别忘了添加@符号.

这在MacOS High Sierra 10.13.4和Android Studio 3.1.2上进行了测试.

Android相关问答推荐

Jetpack编写Lazy列滑动删除动画不顺利结束

合成 colored颜色 的GSON反序列化

懒惰的垂直网格中盒子的重量-Jetpack组合

组成底部导航栏,自定义形状,周围透明

Android Kotlin ImageView内置于Kotlin ImageView中.适配器未按预期更新

Android kotlin 中闪屏 API 执行完成后如何根据身份验证将用户导航到特定屏幕

了解 CoroutineScope(Job() + Dispatchers.Main) 语法

闪屏 API 无法在 Android 12 上运行(API 31、32)

在 AGP 8.0 中构建失败,无法应用插件realm-android. APIandroid.registerTransform已删除

如何绘制内边框?

AirDroid Business 如何能够从屏幕截图中排除覆盖?

Jetpack Compose 动画的行为是什么?

如何在 Jetpack Compose 中的 VisualTransformation 之后将光标保持在文本字段的末尾

如何在 Android 应用中录制短视频?

Jetpack Compose:对角拆分卡片并将内容放入其中

使用 Room 在 SQLite 中保存复杂的 JSON 响应

Jetpack Compose Material3 - switch 标签

Android 应用程序在启动时自动启动

Android Studio,Db 连接错误:发生异常情况导致驱动程序失败.请报告此异常

为什么在try 实例化 Mediaplayer 时会出现 NullPointerException?安卓Kotlin