android - 在 Windows 中从 Jenkins 启动 android 模拟器 adb(运行仪器测试,模拟器不会出现)

标签 android windows jenkins android-emulator android-testing

我想从 Jenkins 启动模拟器来测试 Android 应用程序。这是我在 jenkins 和控制台输出中的项目设置:

setup and output

当我尝试使用现有的模拟器设备和他的名字尝试 Jenkins android 模拟器插件时,设置和输出在这里:Jenkins emulator plugin setup and console output

构建成功,但在测试运行时看不到正在运行的模拟器。

这两个选项的奇怪之处在于,当我启动命令行并键入这两个命令时,模拟器始终显示并且运行正常。但是从 Jenkins 那里,在第二个选项中我看不到它。第一个选项被卡住了。请看屏幕。

有人可以帮我提点建议吗?我尝试了很多选项,但我无法弄明白。

非常感谢:)

P.S.: 这是输出文本(以防有人想复制它)

1)

C:\Program Files (x86)\Jenkins\workspace\Android Sandbox>C:\Users\josef\AppData\Local\Android\Sdk/tools/emulator -avd Nexus_4_API_22 -accel auto 
emulator: WARNING: encryption is off
Hax is enabled
Hax ram_size 0x40000000
HAX is working and emulator runs in fast virt mode.

2)

$ C:\Users\josef\AppData\Local\Android\Sdk/tools/android.bat list target
[android] Using Android SDK: C:\Users\josef\AppData\Local\Android\Sdk
$ C:\Users\josef\AppData\Local\Android\Sdk/platform-tools/adb.exe start-server
* daemon not running. starting it now at tcp:5824 *
* daemon started successfully *
$ C:\Users\josef\AppData\Local\Android\Sdk/platform-tools/adb.exe start-server
[android] Starting Android emulator
[android] Erasing existing emulator data...
$ C:\Users\josef\AppData\Local\Android\Sdk/tools/emulator.exe -engine classic -ports 5684,5685 -report-console tcp:5845,max=60 -avd Nexus_4_API_22 -no-snapshot-load -no-snapshot-save -wipe-data -engine auto
emulator: WARNING: encryption is off
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
Hax is enabled
Hax ram_size 0x40000000
HAX is working and emulator runs in fast virt mode.
emulator: WARNING: Requested adb port (5685) 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 684
[android] Waiting for emulator to finish booting...
$ C:\Users\josef\AppData\Local\Android\Sdk/platform-tools/adb.exe -s emulator-5684 wait-for-device shell getprop init.svc.bootanim
[android] Emulator reported that the startup process is 'running'
$ C:\Users\josef\AppData\Local\Android\Sdk/platform-tools/adb.exe -s emulator-5684 wait-for-device shell getprop init.svc.bootanim
[android] Emulator reported that the startup process is 'stopped'
$ C:\Users\josef\AppData\Local\Android\Sdk/platform-tools/adb.exe -s emulator-5684 logcat -v time
[android] Emulator is ready for use (took 31 seconds)
[Gradle] - Launching build.
[Android Sandbox] $ cmd.exe /C '""C:\Program Files (x86)\Jenkins\workspace\Android Sandbox\gradlew.bat"' clean connectedAndroidTest && exit %%ERRORLEVEL%%"
Starting a Gradle Daemon, 2 incompatible and 5 stopped Daemons could not be reused, use --status for details
NDK is missing a "platforms" directory.
If you are using NDK, verify the ndk.dir is set to a valid NDK directory.  It is currently set to C:\Users\josef\AppData\Local\Android\Sdk\ndk-bundle.
If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.

最佳答案

我建议使用命令行而不是 Android 模拟器插件。 This article is helpful

关于android - 在 Windows 中从 Jenkins 启动 android 模拟器 adb(运行仪器测试,模拟器不会出现),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45029840/

相关文章:

c++ - 如何在 C++ 中获取有关服务启动类型的信息?

windows - 从 IIS 上的命令行列出所有托管网站

plugins - Jenkins - 通过 CIFS 插件发布不传输名称中带有空格的文件夹中存在的文件

grails - 向 chalice 目标添加额外的配置属性

带有后退按钮的 Android 新 Intent

android - Stericson 的根工具库不工作 - 强制关闭?

带有 FCGI 的 Apache 上的 Django - 高负载下 500 内部服务器错误

Jenkins 自己的作业预留节点

android - On Drag Listener 多个 IF 语句

安卓 : Which method is called when fragment is pop out from backstack