在Windows中从Jenkins启动android模拟器adb(运行已检测的测试,不会出现模拟器) [英] Start android emulator adb from Jenkins in windows (run instrumented tests, emulator does not appear)

查看:114
本文介绍了在Windows中从Jenkins启动android模拟器adb(运行已检测的测试,不会出现模拟器)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I would like to start emulator from Jenkins to test Android app. This is my setup of the project in jenkins and console output:

当我尝试使用现有的模拟器设备及其名称尝试Jenkins android模拟器插件时,设置和输出在此处:

When I tried Jenkins android emulator plugin with existing emulator device and his name, setup and output is here:

构建成功,但是在测试运行时我看不到正在运行的仿真器.

The build is successful, but I cant see the running emulator when testing is running.

这两个选项的奇怪之处在于,当我启动命令行并键入这两个命令时,总是显示模拟器,并且模拟器运行正常.但是从詹金斯看来,在第二种选择中我看不到它.第一个选择被卡住了.请查看屏幕.

Strange thing of these two options is, that when I start the command line and type these two commands, the emulator is always shown and it is running normally. But from Jenkins, in the second option I cant see it. And first option is stuck. See the screens please.

有人可以帮我一些建议吗?我尝试了很多选择,但无法弄清楚.

Can somebody help me with some advice? I have tried many options and I cant figure it out.

非常感谢:)

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

P.S.: Here are the output texts (in case that somebody would like to copy it)

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 Emulator插件. 这篇文章很有帮助

I recommend using the command lines instead of Android Emulator Plugin. This article is helpful

这篇关于在Windows中从Jenkins启动android模拟器adb(运行已检测的测试,不会出现模拟器)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆