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

时间:2017-07-11 08:56:41

标签: android windows jenkins android-emulator android-testing

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

setup and output

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

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

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

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

非常感谢:)

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.

1 个答案:

答案 0 :(得分:2)

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