gpt4 book ai didi

android - 在 headless (headless)服务器上运行 android 模拟器

转载 作者:搜寻专家 更新时间:2023-11-01 09:29:36 27 4
gpt4 key购买 nike

我有一个 headless (headless)的 Debian 服务器,用于 CI 和测试。我不知道发生了什么但它坏了,所以我删除了整个 SDK 并从头开始。

我做到了:

  • 检索最新的 URL:

    curl -s 'https://developer.android.com/studio/index.html#downloads' \
    | grep -oP 'https?://dl.google.com/android/repository/sdk-tools-linux[^" ]+' \
    | sort | uniq
  • 下载并解压
  • 更新了 SDK 管理器:

     ./tools/bin/sdkmanager --update
  • 接受许可:

     yes | ./tools/bin/sdkmanager --licenses
  • 为 API 级别 27 安装了所有内容:

    ./tools/bin/sdkmanager --install "platforms;android-27" "system-images;android-27;google_apis;x86"
  • 我已经按照说明安装了KVM和Qemu
  • 我创建了一个 AVD:

    echo no | ./tools/bin/avdmanager create avd --force --name avdname -k "system-images;android-27;google_apis;x86"
  • 然后启动模拟器:

    ./emulator/emulator @avdname -no-window

它启动了,但在 logcat 中它提示缺少 Qemu:

01-09 23:15:19.278  4075  4075 D libEGL  : Emulator has vendor provided software renderer, qemu.gles is set to 2.
01-09 23:15:19.282 4075 4075 D libEGL : loaded /vendor/lib/egl/libEGL_emulation.so
01-09 23:15:19.283 4075 4075 D libEGL : loaded /vendor/lib/egl/libGLESv1_CM_emulation.so
01-09 23:15:19.288 4075 4075 D libEGL : loaded /vendor/lib/egl/libGLESv2_emulation.so
01-09 23:15:19.294 4075 4075 E : connect: failed with fd -1 errno 22
01-09 23:15:19.294 4075 4075 E : Failed to connect to host (QemuPipeStream)!!!
01-09 23:15:19.294 4075 4075 E EGL_emulation: Failed to establish connection with the host
01-09 23:15:19.294 4075 4075 W libEGL : eglInitialize(0xab2fb014) failed (EGL_SUCCESS)
01-09 23:15:19.295 4075 4075 I /system/bin/surfaceflinger: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
01-09 23:15:19.295 4075 4075 E EGL_emulation: tid 4075: eglGetConfigs(774): error 0x3001 (EGL_NOT_INITIALIZED)
01-09 23:15:19.295 4075 4075 E EGL_emulation: tid 4075: eglChooseConfig(796): error 0x3001 (EGL_NOT_INITIALIZED)
01-09 23:15:19.295 4075 4075 E EGL_emulation: tid 4075: eglGetConfigs(774): error 0x3001 (EGL_NOT_INITIALIZED)
01-09 23:15:19.295 4075 4075 E EGL_emulation: tid 4075: eglChooseConfig(796): error 0x3001 (EGL_NOT_INITIALIZED)
01-09 23:15:19.295 4075 4075 W SurfaceFlinger: no suitable EGLConfig found, trying a simpler query
01-09 23:15:19.296 4075 4075 E EGL_emulation: tid 4075: eglGetConfigs(774): error 0x3001 (EGL_NOT_INITIALIZED)
01-09 23:15:19.296 4075 4075 E EGL_emulation: tid 4075: eglChooseConfig(796): error 0x3001 (EGL_NOT_INITIALIZED)
01-09 23:15:19.296 4075 4075 F SurfaceFlinger: no suitable EGLConfig found, giving up
01-09 23:15:19.296 4075 4075 F libc : Fatal signal 6 (SIGABRT), code -6 in tid 4075 (surfaceflinger), pid 4075 (surfaceflinger)
01-09 23:15:19.305 4086 4086 I crash_dump32: obtaining output fd from tombstoned, type: kDebuggerdTombstone
01-09 23:15:19.306 1592 1592 I /system/bin/tombstoned: received crash request for pid 4075
01-09 23:15:19.307 4086 4086 I crash_dump32: performing dump of process 4075 (target tid = 4075)

我有 hw.gpu.enabled = false,不确定它是否相关。

KVM 很高兴:

$ ./tools/emulator -accel-check
accel:
0
KVM (version 12) is installed and usable.
accel

我不知道是 KVM 问题还是 GPU 加速问题。

有趣的是,这就像一个魅力:

./tools/bin/sdkmanager --install "system-images;android-26;google_apis;x86_64" "platforms;android-26"
echo no | ./tools/bin/avdmanager create avd --force --name avd26 -k "system-images;android-26;google_apis;x86_64"
./emulator/emulator @avd26 -no-window

是因为它是 x86_64 图像吗?因为 API 27 系统镜像有问题?为什么没有用于 API 27 b 的 64 位图像?

最佳答案

试试 -gpu swiftshader。这似乎解决了我的问题。

关于android - 在 headless (headless)服务器上运行 android 模拟器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48178270/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com