【问题标题】:Jenkins Android Emulator Plugin not runningJenkins Android 模拟器插件未运行
【发布时间】:2017-06-28 13:04:52
【问题描述】:

我正在尝试探索和使用 Jenkins Android 模拟器插件,以便在 CI 环境中运行我的模拟器。到目前为止,我已经尝试了 3 种不同的方法,但没有一个能够运行模拟器

方法一:使用现有模拟器

Screenshot of the first method

在作业的配置中,选择Run an Android emulator during build,然后选择Run existing emulator。在 AVD 名称中,我插入 Nexus5X_6_8664,然后 Jenkins 就能找到它。

当我运行作业时,它给了我以下错误:

Started by user Amine
Building in workspace D:\jenkins\workspace\Emulator
[android] Using Android SDK: D:\Tools\Dev\sdk\
$ D:\Tools\Dev\sdk\/platform-tools/adb.exe start-server
* daemon not running. starting it now at tcp:5857 *
* daemon started successfully *
$ D:\Tools\Dev\sdk\/platform-tools/adb.exe start-server
[android] Starting Android emulator
$ D:\Tools\Dev\sdk\/tools/emulator.exe -engine classic -ports 5768,5769 -report-console tcp:5833,max=60 -avd Nexus5X_6_8664 -no-snapshot-load -no-snapshot-save
init: Could not find wglGetExtensionsStringARB!
getGLES2ExtensionString: Could not find GLES 2.x config!
Failed to obtain GLES 2.x extensions string!
Could not initialize emulated framebuffer
emulator: device fd:964

HAXM is working and emulator runs in fast virt mode
emulator: WARNING: Requested adb port (5769) is outside the recommended range [5555,5586]. ADB may not function properly for the emulator. See -help-port for details.
[android] Emulator reported that the console is available on port 5 768
[android] Waiting for emulator to finish booting...
$ D:\Tools\Dev\sdk\/platform-tools/adb.exe -s emulator-5768 wait-for-device shell getprop init.svc.bootanim
emulator: ERROR: Could not initialize OpenglES emulation, use '-gpu off' to disable it.
ERROR: Timeout after 45000 milliseconds

$ D:\Tools\Dev\sdk\/platform-tools/adb.exe kill-server
Finished: NOT_BUILT

更多细节:

方法二:新建模拟器

Screenshot of the second method

在作业的配置中,选择“Run an Android emulator during build”,然后选择“Run emulator with properties”:

  • Android 操作系统版本:android-23
  • 屏幕密度:hdpi
  • 屏幕分辨率:480x800
  • 设备区域设置:en_US
  • SD卡大小:64M
  • 目标 ABI:x86_64
  • 模拟器名称后缀

当我运行作业时,它给了我以下错误:

Started by user Amine
Building in workspace D:\jenkins\workspace\Emulator
[android] Using Android SDK: D:\Tools\Dev\sdk\
[android] Creating Android AVD: C:\Users\Amine\.android\avd\hudson_en-US_240_WVGA_android-23_x86_64_mySuffix.avd
[android] D:\Tools\Dev\sdk\/tools/android.bat create avd -f -a -c 64M -s WVGA800 -n hudson_en-US_240_WVGA_android-23_x86_64_mySuffix -t android-23 --abi x86_64
[android] Could not create Android emulator: Failed to parse AVD config file
Finished: NOT_BUILT

当我在命令行上手动运行上述相同命令以调查错误时,它会给出以下错误:

Error: Flag '-s' is not valid for 'create avd'.

我尝试删除-s,然后删除-t,然后它会请求:

Error: Package path (-k) not specified. Valid system image paths are:
system-images;android-23;default;armeabi-v7a
system-images;android-23;google_apis;x86
system-images;android-23;default;x86_64
system-images;android-23;google_apis;x86_64
system-images;android-23;default;x86
system-images;android-23;google_apis;armeabi-v7a

方法3:使用命令行代替Android Emulator Plugin

[第三种方法的截图][3]

然后我决定放弃 Android 模拟器插件并开始使用来自 jenkins 的常规 Windows 批处理命令,其中包含以下几行:

D:
cd D:\Tools\Dev\sdk\tools\ 
D:\Tools\Dev\sdk\tools\emulator.exe @Nexus5X_6_8664

当我在单独的命令行上运行“adb devices”时,我可以看到我的模拟器最终正在运行;但是模拟器的窗口没有显示,并且一直显示以下错误:

D:\Tools\Dev\sdk\tools>D:\Tools\Dev\sdk\tools\emulator.exe @Nexus5X_6_8664 
Hax is enabled
Hax ram_size 0x60000000
HAX is working and emulator runs in fast virt mode.
init: Could not find wglGetExtensionsStringARB!
OpenGL backend 'angle' without OpenGL ES 1.x library detected. Using GLESv2 only.
eglMakeCurrent failed
eglMakeCurrent failed
eglMakeCurrent failed
eglMakeCurrent failed

请注意,如果我从命令行手动运行D:\Tools\Dev\sdk\tools\emulator.exe @Nexus5X_6_8664,我没有遇到上述错误的任何问题。

更多细节:

  • Jenkins 服务以我作为管理员的登录名/密码访问权限运行。 (我遵循了 cloudbees 教程,效果很好)
  • 我已将 window.x = 0 window.y = 0 添加到 @Nexus5X_6_8664.ini

【问题讨论】:

    标签: jenkins android-emulator jenkins-plugins


    【解决方案1】:

    关于方法一的问题: 您可以尝试更新到最新版本的 SDK 工具。我们有类似的问题,并在最新更新后得到修复。

    更新以下内容并重试:

    1. Android 模拟器 [27.2.9(2018 年 5 月)]
    2. Android SDK 平台工具
    3. Android SDK 工具
    4. 英特尔 x86 仿真器加速器(HAXM 安装程序)

    请按照以下主题进行更新: Emulator: ERROR :detected a hanging thread 'Qt event loop'

    【讨论】:

      猜你喜欢
      • 2013-12-17
      • 2014-07-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-07-13
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多