Jenkins Android Emulator error: device 'localhost:7903' not found (the emulator starts but the connection to it fails)

时间:2016-04-04 17:03:57

标签: android jenkins emulation

I have installed Jenkins with Android Emulator Plugin on my MacMini. But emulator does not work:

Here is the log:

[android] Starting Android emulator
[android] Erasing existing emulator data...
$ /Users/Shared/Jenkins/android-sdk/tools/emulator -ports 7903,7904 -prop persist.sys.language=en -prop persist.sys.country=US -avd hudson_en-US_240_HVGA_android-19_armeabi-v7a_jenkins -no-snapshot-load -no-snapshot-save -wipe-data -no-window -verbose
resize2fs 1.42.13 (17-May-2015)
The filesystem is already 51200 (4k) blocks long.  Nothing to do!

emulator: found SDK root at /Users/Shared/Jenkins/android-sdk
emulator: Android virtual device file at: /Users/Shared/Jenkins/Home/jobs/Champion/workspace/.android/avd/hudson_en-US_240_HVGA_android-19_armeabi-v7a_jenkins.ini
emulator: virtual device content at /Users/Shared/Jenkins/Home/jobs/Champion/workspace/.android/avd/hudson_en-US_240_HVGA_android-19_armeabi-v7a_jenkins.avd
emulator: virtual device config file: /Users/Shared/Jenkins/Home/jobs/Champion/workspace/.android/avd/hudson_en-US_240_HVGA_android-19_armeabi-v7a_jenkins.avd/config.ini
emulator: using core hw config path: /Users/Shared/Jenkins/Home/jobs/Champion/workspace/.android/avd/hudson_en-US_240_HVGA_android-19_armeabi-v7a_jenkins.avd/hardware-qemu.ini
emulator: Found AVD target API level: 19
emulator: Read property file at /Users/Shared/Jenkins/android-sdk/system-images/android-19/default/armeabi-v7a//build.prop
emulator: No boot.prop property file found.
emulator: found skin 'HVGA' in directory: /Users/Shared/Jenkins/android-sdk/platforms/android-19/skins
emulator: autoconfig: -skin HVGA
emulator: autoconfig: -skindir /Users/Shared/Jenkins/android-sdk/platforms/android-19/skins
emulator: found skin-specific hardware.ini: /Users/Shared/Jenkins/android-sdk/platforms/android-19/skins/HVGA/hardware.ini
emulator: keyset loaded from: /Users/Shared/Jenkins/Home/jobs/Champion/workspace/.android/default.keyset
emulator: trying to load skin file '/Users/Shared/Jenkins/android-sdk/platforms/android-19/skins/HVGA/layout'
emulator: skin network speed: 'full'
emulator: skin network delay: 'none'
emulator: autoconfig: -kernel /Users/Shared/Jenkins/android-sdk/system-images/android-19/default/armeabi-v7a//kernel-qemu
emulator: Auto-detect: Kernel image requires legacy device naming scheme.
emulator: Auto-detect: Kernel does support YAFFS2 partitions.
emulator: autoconfig: -ramdisk /Users/Shared/Jenkins/android-sdk/system-images/android-19/default/armeabi-v7a//ramdisk.img
emulator: Using initial system image: /Users/Shared/Jenkins/android-sdk/system-images/android-19/default/armeabi-v7a//system.img
emulator: autoconfig: -data /Users/Shared/Jenkins/Home/jobs/Champion/workspace/.android/avd/hudson_en-US_240_HVGA_android-19_armeabi-v7a_jenkins.avd/userdata-qemu.img
emulator: autoconfig: -initdata /Users/Shared/Jenkins/Home/jobs/Champion/workspace/.android/avd/hudson_en-US_240_HVGA_android-19_armeabi-v7a_jenkins.avd/userdata.img
emulator: autoconfig: -cache /Users/Shared/Jenkins/Home/jobs/Champion/workspace/.android/avd/hudson_en-US_240_HVGA_android-19_armeabi-v7a_jenkins.avd/cache.img
emulator: autoconfig: -sdcard /Users/Shared/Jenkins/Home/jobs/Champion/workspace/.android/avd/hudson_en-US_240_HVGA_android-19_armeabi-v7a_jenkins.avd/sdcard.img
emulator: Physical RAM size: 512MB

emulator: autoconfig: -snapstorage /Users/Shared/Jenkins/Home/jobs/Champion/workspace/.android/avd/hudson_en-US_240_HVGA_android-19_armeabi-v7a_jenkins.avd/snapshots.img
emulator: GPU emulation is disabled
emulator: WARNING: CPU acceleration only works with x86/x86_64 system images.
Content of hardware configuration file:
  hw.cpu.arch = arm
  hw.cpu.model = cortex-a8
  hw.ramSize = 512
  hw.screen = touch
  hw.mainKeys = yes
  hw.trackBall = yes
  hw.keyboard = no
  hw.keyboard.lid = no
  hw.keyboard.charmap = qwerty2
  hw.dPad = yes
  hw.gsmModem = yes
  hw.gps = yes
  hw.battery = yes
  hw.accelerometer = yes
  hw.audioInput = yes
  hw.audioOutput = yes
  hw.sdCard = yes

  disk.cachePartition = yes
  disk.cachePartition.path = /Users/Shared/Jenkins/Home/jobs/Champion/workspace/.android/avd/hudson_en-US_240_HVGA_android-19_armeabi-v7a_jenkins.avd/cache.img
  disk.cachePartition.size = 66m
  hw.lcd.width = 320
  hw.lcd.height = 480
  hw.lcd.depth = 16
  hw.lcd.density = 160
  hw.lcd.backlight = yes
  hw.gpu.enabled = no
  hw.initialOrientation = portrait
  hw.camera.back = emulated
  hw.camera.front = none
  vm.heapSize = 48
  hw.sensors.proximity = yes
  hw.sensors.magnetic_field = yes
  hw.sensors.orientation = yes
  hw.sensors.temperature = yes
  hw.useext4 = yes
  kernel.path = /Users/Shared/Jenkins/android-sdk/system-images/android-19/default/armeabi-v7a//kernel-qemu
  kernel.parameters =  androidboot.hardware=goldfish android.checkjni=1
  kernel.newDeviceNaming = no
  kernel.supportsYaffs2 = yes
  disk.ramdisk.path = /Users/Shared/Jenkins/android-sdk/system-images/android-19/default/armeabi-v7a//ramdisk.img
  disk.systemPartition.initPath = /Users/Shared/Jenkins/android-sdk/system-images/android-19/default/armeabi-v7a//system.img
  disk.systemPartition.size = 550m
  disk.dataPartition.path = /Users/Shared/Jenkins/Home/jobs/Champion/workspace/.android/avd/hudson_en-US_240_HVGA_android-19_armeabi-v7a_jenkins.avd/userdata-qemu.img
  disk.dataPartition.initPath = /Users/Shared/Jenkins/Home/jobs/Champion/workspace/.android/avd/hudson_en-US_240_HVGA_android-19_armeabi-v7a_jenkins.avd/userdata.img
  disk.dataPartition.size = 200m
  disk.snapStorage.path = /Users/Shared/Jenkins/Home/jobs/Champion/workspace/.android/avd/hudson_en-US_240_HVGA_android-19_armeabi-v7a_jenkins.avd/snapshots.img
  avd.name = hudson_en-US_240_HVGA_android-19_armeabi-v7a_jenkins
.
QEMU options list:
emulator: argv[00] = "/Users/Shared/Jenkins/android-sdk/tools/emulator64-arm"
emulator: argv[01] = "-boot-property"
emulator: argv[02] = "persist.sys.language=en"
emulator: argv[03] = "-boot-property"
emulator: argv[04] = "persist.sys.country=US"
emulator: argv[05] = "-android-ports"
emulator: argv[06] = "7903,7904"
emulator: argv[07] = "-android-hw"
emulator: argv[08] = "/Users/Shared/Jenkins/Home/jobs/Champion/workspace/.android/avd/hudson_en-US_240_HVGA_android-19_armeabi-v7a_jenkins.avd/hardware-qemu.ini"
Concatenated QEMU options:
 /Users/Shared/Jenkins/android-sdk/tools/emulator64-arm -boot-property persist.sys.language=en -boot-property persist.sys.country=US -android-ports 7903,7904 -android-hw /Users/Shared/Jenkins/Home/jobs/Champion/workspace/.android/avd/hudson_en-US_240_HVGA_android-19_armeabi-v7a_jenkins.avd/hardware-qemu.ini
emulator: Starting QEMU main loop
emulator:     trying to find: /Users/Shared/Jenkins/android-sdk/tools/lib/ca-bundle.pem

emulator: registered 'boot-properties' qemud service
emulator: registered 'boot-properties' qemud service
emulator: Adding boot property: 'persist.sys.language' = 'en'
emulator: Adding boot property: 'persist.sys.country' = 'US'
emulator: Using kernel serial device prefix: ttyS
emulator: Ramdisk image contains fstab.goldfish file
emulator: Found format of system partition: 'ext4'
emulator: Found format of userdata partition: 'ext4'
emulator: Found format of cache partition: 'ext4'
emulator: system partition format: ext4
emulator: Mapping 'system' partition image to /tmp/android-jenkins/emulator-dyB0c4
emulator: nand_add_dev: system,size=0x22600000,file=/tmp/android-jenkins/emulator-dyB0c4,initfile=/Users/Shared/Jenkins/android-sdk/system-images/android-19/default/armeabi-v7a//system.img,pagesize=512,extrasize=0
Creating filesystem with parameters:
    Size: 209715200
    Block size: 4096
    Blocks per group: 32768
    Inodes per group: 6400
    Inode size: 256
    Journal blocks: 1024
    Label: 
    Blocks: 51200
    Block groups: 2
    Reserved block group size: 15
Created filesystem with 11/12800 inodes and 1865/51200 blocks
emulator: userdata partition format: ext4
emulator: nand_add_dev: userdata,size=0xc800000,file=/Users/Shared/Jenkins/Home/jobs/Champion/workspace/.android/avd/hudson_en-US_240_HVGA_android-19_armeabi-v7a_jenkins.avd/userdata-qemu.img,initfile=/Users/Shared/Jenkins/Home/jobs/Champion/workspace/.android/avd/hudson_en-US_240_HVGA_android-19_armeabi-v7a_jenkins.avd/userdata.img,pagesize=512,extrasize=0
emulator: cache partition format: ext4
emulator: Creating empty cache partition image at: /Users/Shared/Jenkins/Home/jobs/Champion/workspace/.android/avd/hudson_en-US_240_HVGA_android-19_armeabi-v7a_jenkins.avd/cache.img
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
emulator: nand_add_dev: cache,size=0x4200000,file=/Users/Shared/Jenkins/Home/jobs/Champion/workspace/.android/avd/hudson_en-US_240_HVGA_android-19_armeabi-v7a_jenkins.avd/cache.img,pagesize=512,extrasize=0
emulator: Adding boot property: 'dalvik.vm.heapsize' = '48m'
emulator: Adding boot property: 'ro.config.low_ram' = 'true'
emulator: Adding boot property: 'qemu.sf.lcd_density' = '160'
emulator: Adding boot property: 'qemu.hw.mainkeys' = '1'
emulator: Adding boot property: 'qemu.sf.fake_camera' = 'back'
emulator: Kernel parameters: qemu.gles=0 qemu=1 console=ttyS0 android.qemud=ttyS1 androidboot.hardware=goldfish android.checkjni=1 ndns=1
emulator: warning: opening audio input failed

emulator: Forcing ro.adb.qemud to "0".
emulator: sent '0012host:emulator:7904' to ADB server
emulator: android_hw_fingerprint_init: fingerprint qemud listen service initialized

emulator: Failed to parse AndroidStudio preferences file usage.statistics.xml
emulator: Defaulting user crash-report opt-in to false
emulator: Skipping metrics reporting: No user opt-in.
emulator: UpdateChecker: skipped version check
goldfish_fb_get_pixel_format:170: display surface,pixel format:
  bits/pixel:  16
  bytes/pixel: 2
  depth:       16
  red:         bits=5 mask=0xf800 shift=11 max=0x1f
  green:       bits=6 mask=0x7e0 shift=5 max=0x3f
  blue:        bits=5 mask=0x1f shift=0 max=0x1f
  alpha:       bits=0 mask=0x0 shift=0 max=0x0
$ /Users/Shared/Jenkins/android-sdk/platform-tools/adb connect localhost:7904
unable to connect to localhost:7904: Connection refused
[android] Waiting for emulator to finish booting...
$ /Users/Shared/Jenkins/android-sdk/platform-tools/adb -s localhost:7904 shell getprop init.svc.bootanim
error: device 'localhost:7904' not found
$ /Users/Shared/Jenkins/android-sdk/platform-tools/adb connect localhost:7904
$ /Users/Shared/Jenkins/android-sdk/platform-tools/adb -s localhost:7904 shell getprop init.svc.bootanim
error: device 'localhost:7904' not found

I have tried different emulators (API level 15,16,17,18,19,20). I have also tried different Android Emulator Plugin-Versions (2.13.1 and 2.10). Nothing seems to work. Please help.

2 个答案:

答案 0 :(得分:2)

Android emulator plugin中的{p> Jenkins非常稳定(可能是插件问题或我的Jenkins构建机器)。我发现有一种配置对我有用。

这是日志中的行(与您的行比较): $/backup/android-sdk-linux/tools/emulator -ports 7379,7380 -prop persist.sys.language=en -prop persist.sys.country=US -avd hudson_en-US_160_WXGA800_android-17_x86_namshi -no-snapshot-load -no-snapshot-save -no-window -no-boot-anim -noaudio -verbose

这里的工作模拟器配置如何:

emulator config

我的建议是使用不同的配置并找到一个稳定的。此外,如果端口繁忙,请尝试重新启动Jenkins计算机,看看它是否有帮助。

答案 1 :(得分:0)

感谢您的帮助。在我的情况下,解决方案是将android模拟器插件降级到版本2.12。最新版本(2.13.1)在我的案例中不起作用。