具有 Google API 的 Android 模拟器未在 Ubuntu Server 16.04 上以 Jenkins 启动

标签 android jenkins android-emulator ubuntu-server

在带有 Android 模拟器插件的 Ubunut 服务器 16.04 上使用 Jenkins,当我将操作系统版本设置为“android-19”时,我设法让它工作。下面是设置的简短屏幕截图:

enter image description here

虽然这适用于插件和模拟器,但我的应用程序需要 Google Play 服务才能正常运行。使用 Google API 搜索 android 的图像(这听起来像我需要的)我最终进入了插件的帮助页面,因为它说:

As mentioned above, the "Android OS version" field will auto-complete to existing SDK versions such as "1.5" or "2.2". However, it is possible to enter different values in this field, for example if you want to use an Android SDK add-on that you have installed, e.g. the Google APIs add-on or the Samsung GALAXY Tab add-on. In these cases, just enter the appropriate value given by the "android list target" command.

For example: The Google APIs add-on, based on an Android 1.6 emulator: Google Inc.:Google APIs:4

因此,我尝试使用以下内容填充 Android OS 版本:Google Inc.:Google APIs:19,结果发现我在使用 Target ABI 时遇到了一些问题。进一步查找发现,在使用OS的这种命名方式时,必须在Target ABI前加一个tag。它应该是:“google_apis/armeabi-v7a”

然后设置看起来像:

enter image description here

但是当我构建时,我收到一条很长的控制台终端消息,等待模拟器启动,这看起来从未发生过:

$ /var/lib/jenkins/tools/android-sdk/tools/android list target
[android] Using Android SDK: /var/lib/jenkins/tools/android-sdk
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb start-server
* daemon not running. starting it now at tcp:5825 *
* daemon started successfully *
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb start-server
[android] Starting Android emulator
$ /var/lib/jenkins/tools/android-sdk/tools/emulator -engine classic -ports 5782,5783 -report-console tcp:5836,max=60 -prop persist.sys.language=pt -prop persist.sys.country=BR -avd hudson_pt-BR_160_WQVGA_Google_Inc._Google_APIs_19_google_apis-armeabi-v7a_testing2 -no-snapshot-load -no-snapshot-save -no-window
WARNING: Force to use classic engine to support snapshot.
ERROR: resizing partition e2fsck failed with exit code 8
emulator: WARNING: Classic qemu does not support SMP. The hw.cpu.ncore option from your config file is ignored.
emulator: warning: opening audio output failed

emulator: WARNING: Requested adb port (5783) is outside the recommended range [5555,5586]. ADB may not function properly for the emulator. See -help-port for details.
emulator: Listening for console connections on port: 5782
emulator: Serial number of this emulator (for ADB): emulator-5782
[android] Emulator reported that the console is available on port 5,782
[android] Waiting for emulator to finish booting...
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s emulator-5782 wait-for-device shell getprop init.svc.bootanim
[android] Emulator reported that the startup process is ''
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s emulator-5782 wait-for-device shell getprop init.svc.bootanim
[android] Emulator reported that the startup process is ''
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s emulator-5782 wait-for-device shell getprop init.svc.bootanim
[android] Emulator reported that the startup process is ''
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s emulator-5782 wait-for-device shell getprop init.svc.bootanim
[android] Emulator reported that the startup process is ''
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s emulator-5782 wait-for-device shell getprop init.svc.bootanim
[android] Emulator reported that the startup process is ''
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s emulator-5782 wait-for-device shell getprop init.svc.bootanim
[android] Emulator reported that the startup process is ''
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s emulator-5782 wait-for-device shell getprop init.svc.bootanim
[android] Emulator reported that the startup process is ''
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s emulator-5782 wait-for-device shell getprop init.svc.bootanim
[android] Emulator reported that the startup process is ''
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s emulator-5782 wait-for-device shell getprop init.svc.bootanim
[android] Emulator reported that the startup process is ''
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s emulator-5782 wait-for-device shell getprop init.svc.bootanim
[android] Emulator reported that the startup process is ''
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s emulator-5782 wait-for-device shell getprop init.svc.bootanim
[android] Emulator reported that the startup process is ''
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s emulator-5782 wait-for-device shell getprop init.svc.bootanim
[android] Emulator reported that the startup process is ''
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s emulator-5782 wait-for-device shell getprop init.svc.bootanim
[android] Emulator reported that the startup process is ''
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s emulator-5782 wait-for-device shell getprop init.svc.bootanim
[android] Emulator reported that the startup process is ''
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s emulator-5782 wait-for-device shell getprop init.svc.bootanim
[android] Emulator reported that the startup process is ''
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s emulator-5782 wait-for-device shell getprop init.svc.bootanim
[android] Emulator reported that the startup process is ''
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s emulator-5782 wait-for-device shell getprop init.svc.bootanim
[android] Emulator reported that the startup process is ''
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s emulator-5782 wait-for-device shell getprop init.svc.bootanim
[android] Emulator reported that the startup process is ''
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s emulator-5782 wait-for-device shell getprop init.svc.bootanim
[android] Emulator reported that the startup process is ''
[android] Timed-out after waiting 360 seconds for emulator
[android] Stopping Android emulator

[android] Emulator reported that the startup process is '', Android OS Version android-19, 显示为 [android] Emulator reported that the startup process is 'running' 但使用 Google API 似乎无法启动。

我哪里设置错了?

最佳答案

我正在调查类似的问题。您的第一个问题是模拟器正在尝试连接到不存在的 adb 端口。

$/var/lib/jenkins/tools/android-sdk/platform-tools/adb start-server 守护进程未运行。现在开始 tcp:5825

/var/lib/jenkins/tools/android-sdk/tools/emulator -engine classic -ports 5782,5783 -report-console tcp:5836,max=60 -prop persist.sys .language=pt -prop persist.sys.country=BR -avd hudson_pt-BR_160_WQVGA_Google_Inc._Google_APIs_19_google_apis-armeabi-v7a_testing2 -no-snapshot-load -no-snapshot-save -no-window 警告:强制使用经典引擎支持快照。

如果您能让这些端口匹配,它应该可以工作。我的猜测是插件有问题。可能存在一些文件权限问题或插件中的任何内容旨在使端口在执行之间匹配。有一个环境变量,您可以在其中指定 adb 服务器端口。我是 jenkins 的新手,还没有开始工作。

关于具有 Google API 的 Android 模拟器未在 Ubuntu Server 16.04 上以 Jenkins 启动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45491608/

相关文章:

android - 如何使用 Android 模拟器在 AVD 内旋转屏幕(不是 AVD 旋转)

android - Eclipse 正在从 SDK 文件夹加载框架信息和布局库。

android - 从 URL 播放视频 -Android

jenkins - 在 vscode 或 intellij 中为 jenkins 开发 groovy 脚本

java - Sonar分析导致通过Jenkins在maven项目上索引0个文件

jenkins - 如何手动删除 Hudson 上的作业

Android 模拟器 - 意外的 '-prop' 值

android - 日期变量自动获取到 1970 年的年份。它必须是 2015 年

android - 如何在 Android 上的 TextVIew 上实现 5 秒内从 0 到 600 的数字动画

android - 适用于 Android 的 Visual Studio 模拟器是否支持 OpenGL ES 3.0?