Jenkins Android Emulator插件无法启动,90000毫秒后超时,adb -s emulator-5758等待设备shell getprop init.svc.bootanim

时间:2017-05-16 14:32:17

标签: android jenkins android-emulator-plugin

我正在尝试在我的Jenkins服务器上运行android测试。 第一个问题是我的机器不支持硬件加速。我可以在日志中看到这一点,这可能是问题所在:

15:56:33 emulator: CPU Acceleration status: KVM requires a CPU that supports vmx or svm
15:56:33 emulator: WARNING: x86_64 emulation may not work without hardware acceleration!

我可以通过传递以下标志来启动模拟器:

-accel off  -no-accel   -no-audio -gpu off -verbose  

但它似乎在等待模拟器并超时。 请查看Jenkins服务器的完整日志:

15:55:34 Started by user Paul Stafford
15:55:34 Building in workspace /var/lib/jenkins/workspace/AndroidJenkins
15:55:34  > git rev-parse --is-inside-work-tree # timeout=10
15:55:34 Fetching changes from the remote Git repository
15:55:34  > git config remote.origin.url https://www.boomtastic.org/boomtastic/mobile-android-boom.git # timeout=10
15:55:34 Fetching upstream changes from https://www.boomtastic.org/boomtastic/mobile-android-boom.git
15:55:34  > git --version # timeout=10
15:55:34 using GIT_ASKPASS to set credentials 
15:55:34  > git fetch --tags --progress https://www.boomtastic.org/boomtastic/mobile-android-boom.git +refs/heads/*:refs/remotes/origin/*
15:55:37  > git rev-parse refs/remotes/origin/feature-bees/new_android_app^{commit} # timeout=10
15:55:37  > git rev-parse refs/remotes/origin/origin/feature-bees/new_android_app^{commit} # timeout=10
15:55:37 Checking out Revision b3f9bf59d5a55b33a4eb12914ff4a6c3eb5ea7f6 (refs/remotes/origin/feature-bees/new_android_app)
15:55:37  > git config core.sparsecheckout # timeout=10
15:55:37  > git checkout -f b3f9bf59d5a55b33a4eb12914ff4a6c3eb5ea7f6
15:55:37  > git rev-list b3f9bf59d5a55b33a4eb12914ff4a6c3eb5ea7f6 # timeout=10
15:55:37 [android] Using Android SDK: /opt/android-sdk-linux25.2.5
15:55:37 [android] Creating Android AVD: /var/lib/jenkins/.android/avd/hudson_en-US_160_WVGA_android-23_x86_64_-jenkins.avd
15:55:37 [android] /opt/android-sdk-linux25.2.5/tools/android create avd -f -a -c 32M -s WVGA800 -n hudson_en-US_160_WVGA_android-23_x86_64_-jenkins -t android-23 --abi x86_64
15:55:50 $ /opt/android-sdk-linux25.2.5/platform-tools/adb start-server
15:55:53 * daemon not running. starting it now at tcp:5825 *
15:55:53 * daemon started successfully *
15:55:53 $ /opt/android-sdk-linux25.2.5/platform-tools/adb start-server
15:55:53 [android] Starting Android emulator
15:55:53 $ /opt/android-sdk-linux25.2.5/tools/emulator -engine classic -ports 5758,5759 -report-console tcp:5863,max=60 -prop persist.sys.language=en -prop persist.sys.country=US -avd hudson_en-US_160_WVGA_android-23_x86_64_-jenkins -no-snapshot-load -no-snapshot-save -wipe-data -no-window -accel off -no-accel -no-audio -gpu off -verbose
15:55:53 WARNING: Force to use classic engine to support snapshot.
15:55:54 emulator: Android virtual device file at: /var/lib/jenkins/.android/avd/hudson_en-US_160_WVGA_android-23_x86_64_-jenkins.ini
15:55:54 emulator: virtual device content at /var/lib/jenkins/.android/avd/hudson_en-US_160_WVGA_android-23_x86_64_-jenkins.avd
15:55:54 emulator: virtual device config file: /var/lib/jenkins/.android/avd/hudson_en-US_160_WVGA_android-23_x86_64_-jenkins.avd/config.ini
15:55:54 emulator: using core hw config path: /var/lib/jenkins/.android/avd/hudson_en-US_160_WVGA_android-23_x86_64_-jenkins.avd/hardware-qemu.ini
15:55:54 emulator: Found AVD target API level: 23
15:55:54 emulator: Read property file at /opt/android-sdk-linux25.2.5/system-images/android-23/default/x86_64//build.prop
15:55:54 emulator: No boot.prop property file found.
15:55:54 emulator: found skin 'WVGA800' in directory: /opt/android-sdk-linux25.2.5/platforms/android-23/skins/
15:55:54 emulator: autoconfig: -skin WVGA800
15:55:54 emulator: autoconfig: -skindir /opt/android-sdk-linux25.2.5/platforms/android-23/skins/
15:55:54 emulator: found skin-specific hardware.ini: /opt/android-sdk-linux25.2.5/platforms/android-23/skins//WVGA800/hardware.ini
15:55:54 emulator: autoconfig: -kernel /opt/android-sdk-linux25.2.5/system-images/android-23/default/x86_64//kernel-qemu
15:55:54 emulator: Target arch = 'x86_64'
15:55:54 emulator: Auto-detect: Kernel image requires new device naming scheme.
15:55:54 emulator: Auto-detect: Kernel does not support YAFFS2 partitions.
15:55:54 emulator: autoconfig: -ramdisk /opt/android-sdk-linux25.2.5/system-images/android-23/default/x86_64//ramdisk.img
15:55:54 emulator: Using initial system image: /opt/android-sdk-linux25.2.5/system-images/android-23/default/x86_64//system.img
15:55:54 emulator: autoconfig: -initdata /var/lib/jenkins/.android/avd/hudson_en-US_160_WVGA_android-23_x86_64_-jenkins.avd/userdata.img
15:55:54 emulator: autoconfig: -cache /var/lib/jenkins/.android/avd/hudson_en-US_160_WVGA_android-23_x86_64_-jenkins.avd/cache.img
15:55:54 emulator: autoconfig: -sdcard /var/lib/jenkins/.android/avd/hudson_en-US_160_WVGA_android-23_x86_64_-jenkins.avd/sdcard.img
15:55:54 emulator: Increasing RAM size to 1024MB
15:55:54 emulator: VM heap size 48MB is below hardware specified minimum of 192MB,setting it to that value
15:55:54 emulator: System image is read only
15:55:54 emulator: autoconfig: -snapstorage /var/lib/jenkins/.android/avd/hudson_en-US_160_WVGA_android-23_x86_64_-jenkins.avd/snapshots.img
15:55:54 emulator: GPU emulation is disabled
15:55:54 emulator: Found 2 DNS servers: 10.1.10.3 10.1.10.5
15:55:54 emulator: trying to load skin file '/opt/android-sdk-linux25.2.5/platforms/android-23/skins//WVGA800/layout'
15:55:54 emulator: Found 2 DNS servers: 10.1.10.3 10.1.10.5
15:55:54 emulator: WARNING: Classic qemu does not support SMP. The hw.cpu.ncore option from your config file is ignored.
15:55:54 Content of hardware configuration file:
15:55:54   hw.cpu.arch = x86_64
15:55:54   hw.cpu.ncore = 2
15:55:54   hw.ramSize = 1024
15:55:54   hw.screen = multi-touch
15:55:54   hw.mainKeys = true
15:55:54   hw.trackBall = true
15:55:54   hw.keyboard = false
15:55:54   hw.keyboard.lid = false
15:55:54   hw.keyboard.charmap = qwerty2
15:55:54   hw.dPad = true
15:55:54   hw.gsmModem = true
15:55:54   hw.gps = true
15:55:54   hw.battery = true
15:55:54   hw.accelerometer = true
15:55:54   hw.audioInput = true
15:55:54   hw.audioOutput = true
15:55:54   hw.sdCard = true
15:55:54   hw.sdCard.path = /var/lib/jenkins/.android/avd/hudson_en-US_160_WVGA_android-23_x86_64_-jenkins.avd/sdcard.img
15:55:54   disk.cachePartition = true
15:55:54   disk.cachePartition.path = /var/lib/jenkins/.android/avd/hudson_en-US_160_WVGA_android-23_x86_64_-jenkins.avd/cache.img
15:55:54   disk.cachePartition.size = 66m
15:55:54   hw.lcd.width = 480
15:55:54   hw.lcd.height = 800
15:55:54   hw.lcd.depth = 16
15:55:54   hw.lcd.density = 160
15:55:54   hw.lcd.backlight = true
15:55:54   hw.gpu.enabled = false
15:55:54   hw.gpu.mode = off
15:55:54   hw.gpu.blacklisted = no
15:55:54   hw.initialOrientation = portrait
15:55:54   hw.camera.back = emulated
15:55:54   hw.camera.front = none
15:55:54   vm.heapSize = 192
15:55:54   hw.sensors.light = true
15:55:54   hw.sensors.pressure = true
15:55:54   hw.sensors.humidity = true
15:55:54   hw.sensors.proximity = true
15:55:54   hw.sensors.magnetic_field = true
15:55:54   hw.sensors.orientation = true
15:55:54   hw.sensors.temperature = true
15:55:54   hw.useext4 = true
15:55:54   kernel.path = /opt/android-sdk-linux25.2.5/system-images/android-23/default/x86_64//kernel-qemu
15:55:54   kernel.newDeviceNaming = yes
15:55:54   kernel.supportsYaffs2 = no
15:55:54   disk.ramdisk.path = /opt/android-sdk-linux25.2.5/system-images/android-23/default/x86_64//ramdisk.img
15:56:33   disk.systemPartition.initPath = /opt/android-sdk-linux25.2.5/system-images/android-23/default/x86_64//system.img
15:56:33   disk.systemPartition.size = 1280m
15:56:33   disk.dataPartition.path = /var/lib/jenkins/.android/avd/hudson_en-US_160_WVGA_android-23_x86_64_-jenkins.avd/userdata-qemu.img
15:56:33   disk.dataPartition.initPath = /var/lib/jenkins/.android/avd/hudson_en-US_160_WVGA_android-23_x86_64_-jenkins.avd/userdata.img
15:56:33   disk.dataPartition.size = 2g
15:56:33   disk.snapStorage.path = /var/lib/jenkins/.android/avd/hudson_en-US_160_WVGA_android-23_x86_64_-jenkins.avd/snapshots.img
15:56:33   avd.name = hudson_en-US_160_WVGA_android-23_x86_64_-jenkins
15:56:33 .
15:56:33 emulator: CPU Acceleration: DISABLED
15:56:33 emulator: CPU Acceleration status: KVM requires a CPU that supports vmx or svm
15:56:33 emulator: WARNING: x86_64 emulation may not work without hardware acceleration!
15:56:33 QEMU options list:
15:56:33 emulator: argv[00] = "/opt/android-sdk-linux25.2.5/tools/emulator64-x86"
15:56:33 emulator: argv[01] = "-audio"
15:56:33 emulator: argv[02] = "none"
15:56:33 emulator: argv[03] = "-dns-server"
15:56:33 emulator: argv[04] = "10.1.10.3,10.1.10.5"
15:56:33 emulator: argv[05] = "-serial"
15:56:33 emulator: argv[06] = "null"
15:56:33 emulator: argv[07] = "-serial"
15:56:33 emulator: argv[08] = "null"
15:56:33 emulator: argv[09] = "-boot-property"
15:56:33 emulator: argv[10] = "persist.sys.language=en"
15:56:33 emulator: argv[11] = "-boot-property"
15:56:33 emulator: argv[12] = "persist.sys.country=US"
15:56:33 emulator: argv[13] = "-android-ports"
15:56:33 emulator: argv[14] = "5758,5759"
15:56:33 emulator: argv[15] = "-android-report-console"
15:56:33 emulator: argv[16] = "tcp:5863,max=60"
15:56:33 emulator: argv[17] = "-disable-kvm"
15:56:33 emulator: argv[18] = "-android-hw"
15:56:33 emulator: argv[19] = "/var/lib/jenkins/.android/avd/hudson_en-US_160_WVGA_android-23_x86_64_-jenkins.avd/hardware-qemu.ini"
15:56:33 emulator: argv[20] = "-append"
15:56:33 emulator: argv[21] = "qemu=1 androidboot.hardware=goldfish clocksource=pit android.qemud=1 console=0 console=0 android.checkjni=1 qemu.gles=0 ndns=2"
15:56:33 Concatenated QEMU options:
15:56:33  /opt/android-sdk-linux25.2.5/tools/emulator64-x86 -audio none -dns-server 10.1.10.3,10.1.10.5 -serial null -serial null -boot-property persist.sys.language=en -boot-property persist.sys.country=US -android-ports 5758,5759 -android-report-console tcp:5863,max=60 -disable-kvm -android-hw /var/lib/jenkins/.android/avd/hudson_en-US_160_WVGA_android-23_x86_64_-jenkins.avd/hardware-qemu.ini -append 'qemu=1 androidboot.hardware=goldfish clocksource=pit android.qemud=1 console=0 console=0 android.checkjni=1 qemu.gles=0 ndns=2'
15:56:33 emulator: Starting QEMU main loop
15:56:33 emulator: registered 'boot-properties' qemud service
15:56:33 emulator: Using kernel serial device prefix: ttyGF
15:56:33 emulator: AVD Name: hudson_en-US_160_WVGA_android-23_x86_64_-jenkins
15:56:33 emulator: Ramdisk image contains fstab.goldfish file
15:56:33 emulator: Found format of system partition: 'ext4'
15:56:33 emulator: Found format of userdata partition: 'ext4'
15:56:33 emulator: Found format of cache partition: 'ext4'
15:56:33 emulator: system partition format: ext4
15:56:33 emulator: nand_add_dev: system,size=0x50000000,file=/opt/android-sdk-linux25.2.5/system-images/android-23/default/x86_64//system.img,pagesize=512,extrasize=0,readonly
15:56:33 emulator: userdata partition format: ext4
15:56:33 emulator: nand_add_dev: userdata,size=0x80000000,file=/var/lib/jenkins/.android/avd/hudson_en-US_160_WVGA_android-23_x86_64_-jenkins.avd/userdata-qemu.img,pagesize=512,extrasize=0
15:56:33 emulator: cache partition format: ext4
15:56:33 emulator: Creating empty cache partition image at: /var/lib/jenkins/.android/avd/hudson_en-US_160_WVGA_android-23_x86_64_-jenkins.avd/cache.img
15:56:33 Creating filesystem with parameters:
15:56:33     Size: 69206016
15:56:33     Block size: 4096
15:56:33     Blocks per group: 32768
15:56:33     Inodes per group: 4224
15:56:33     Inode size: 256
15:56:33     Journal blocks: 1024
15:56:33     Label: 
15:56:33     Blocks: 16896
15:56:33     Block groups: 1
15:56:33     Reserved block group size: 7
15:56:33 Created filesystem with 11/4224 inodes and 1302/16896 blocks
15:56:33 emulator: nand_add_dev: cache,size=0x4200000,file=/var/lib/jenkins/.android/avd/hudson_en-US_160_WVGA_android-23_x86_64_-jenkins.avd/cache.img,pagesize=512,extrasize=0
15:56:33 emulator: Adding boot property: 'dalvik.vm.heapsize' = '192m'
15:56:33 emulator: Adding boot property: 'qemu.sf.lcd_density' = '160'
15:56:33 emulator: Adding boot property: 'qemu.hw.mainkeys' = '1'
15:56:33 emulator: Adding boot property: 'qemu.sf.fake_camera' = 'back'
15:56:33 emulator: Found 2 DNS servers: 10.1.10.3 10.1.10.5
15:56:33 emulator: Kernel parameters: qemu=1 androidboot.hardware=goldfish clocksource=pit android.qemud=1 console=0 console=0 android.checkjni=1 qemu.gles=0 ndns=2
15:56:33 emulator:     trying to find: /opt/android-sdk-linux25.2.5/tools/bios.bin
15:56:33 
15:56:33 emulator:     trying to find: /opt/android-sdk-linux25.2.5/tools/lib/pc-bios/bios.bin
15:56:33 
15:56:33 emulator:     trying to find: /opt/android-sdk-linux25.2.5/tools/vgabios-cirrus.bin
15:56:33 
15:56:33 emulator:     trying to find: /opt/android-sdk-linux25.2.5/tools/lib/pc-bios/vgabios-cirrus.bin
15:56:33 
15:56:34 emulator: Adding boot property: 'persist.sys.language' = 'en'
15:56:34 emulator: Adding boot property: 'persist.sys.country' = 'US'
15:56:34 emulator: (android_emulation_setup) using custom adb server port 5825
15:56:34 emulator: ro.adb.qemud invalid or not found, API >= 16, defaulting ro.adb.qemud = 0
15:56:34 emulator: (setup_console_and_adb_ports) trying console port 5758, adb port 5759 (legacy: true)
15:56:34 emulator: (android_console_start) initializing on port 5758
15:56:34 emulator: sent '0012host:emulator:5759' to ADB server
15:56:34 emulator: WARNING: Requested adb port (5759) is outside the recommended range [5555,5586]. ADB may not function properly for the emulator. See -help-port for details.
15:56:34 emulator: Listening for console connections on port: 5758
15:56:34 emulator: Serial number of this emulator (for ADB): emulator-5758
15:56:34 emulator: trying to find console-report client on tcp:5863
15:56:34 emulator: console port number sent to remote. resuming boot
15:56:34 [android] Emulator reported that the console is available on port 5,758
15:56:34 [android] Waiting for emulator to finish booting...
15:56:34 $ /opt/android-sdk-linux25.2.5/platform-tools/adb -s emulator-5758 wait-for-device shell getprop init.svc.bootanim
15:56:34 emulator: android_hw_fingerprint_init: fingerprint qemud listen service initialized
15:56:34 
15:56:34 emulator: Skipping metrics reporting: No user opt-in.
15:58:04 ERROR: Timeout after 90000 milliseconds
15:58:04 $ /opt/android-sdk-linux25.2.5/platform-tools/adb -s emulator-5758 wait-for-device shell getprop init.svc.bootanim
15:59:47 ERROR: Timeout after 90000 milliseconds
15:59:47 $ /opt/android-sdk-linux25.2.5/platform-tools/adb -s emulator-5758 wait-for-device shell getprop init.svc.bootanim
16:01:31 ERROR: Timeout after 90000 milliseconds
16:01:31 $ /opt/android-sdk-linux25.2.5/platform-tools/adb -s emulator-5758 wait-for-device shell getprop init.svc.bootanim
16:03:14 ERROR: Timeout after 90000 milliseconds
16:03:14 $ /opt/android-sdk-linux25.2.5/platform-tools/adb -s emulator-5758 wait-for-device shell getprop init.svc.bootanim
16:04:58 ERROR: Timeout after 90000 milliseconds
16:04:58 $ /opt/android-sdk-linux25.2.5/platform-tools/adb -s emulator-5758 wait-for-device shell getprop init.svc.bootanim
16:06:42 ERROR: Timeout after 90000 milliseconds
16:06:42 $ /opt/android-sdk-linux25.2.5/platform-tools/adb -s emulator-5758 wait-for-device shell getprop init.svc.bootanim
16:08:25 ERROR: Timeout after 90000 milliseconds
16:08:25 [android] Timed-out after waiting 720 seconds for emulator
16:08:39 [android] Stopping Android emulator
16:08:39 $ /opt/android-sdk-linux25.2.5/platform-tools/adb kill-server
16:08:40 Finished: NOT_BUILT

知道如何进行调查吗?

1 个答案:

答案 0 :(得分:1)

这已经是一年前了,但我建议所有试图在Jenkins中设置Android构建过程的人:

直接访问Jenkins机器/服务器(例如通过ssh)并尝试从终端启动模拟器。在OP发布的日志中,您可以看到Jenkins尝试启动模拟器:

  

15:56:34 $ /opt/android-sdk-linux25.2.5/platform-tools/adb -s emulator-5758 wait-for-device shell getprop init.svc.bootanim

也许90秒(90000毫秒)是不够的?您可以从终端在服务器上启动以下命令:

/opt/android-sdk-linux25.2.5/platform-tools/adb -s emulator-5758 wait-for-device shell getprop init.svc.bootanim

并衡量实际需要多长时间。

如果需要花费太多时间,您可以考虑让模拟器在Jenkins机器上运行,并假设它始终准备就绪,因此您需要对UI /检测测试运行以下命令:

./gradlew connectedAndroidTest