Jenkins连接DebugAndroidTest没有连接设备

时间:2017-05-19 03:17:56

标签: jenkins android-emulator android-gradle

我有一个启动Android模拟器并运行connectedDebugAndroidTest gradle任务的Jenkins项目。

第一次一切都很好,但连续构建将失败 由于: com.android.builder.testing.api.DeviceException:没有连接的设备!

我认为我的模拟器运行得很好。因为每次我使用adb设备都会检查模拟器。但是connectedAndroidTest失败了。

Started by upstream project "cp_demo" build number 62
originally caused by:
 Started by user selab
[EnvInject] - Loading node environment variables.
Building on master in workspace /var/lib/jenkins/workspace/em
$ /opt/android-sdk-linux/tools/android list target
[android] Using Android SDK: /opt/android-sdk-linux
$ /opt/android-sdk-linux/platform-tools/adb start-server
* daemon not running. starting it now at tcp:5850 *
* daemon started successfully *
$ /opt/android-sdk-linux/platform-tools/adb start-server
[android] Starting Android emulator
$ /opt/android-sdk-linux/tools/emulator -engine classic -ports 5746,5747 -report-console tcp:5839,max=60 -prop persist.sys.language=en -prop persist.sys.country=US -avd hudson_en-US_160_WVGA_android-23_x86 -no-snapshot-load -no-snapshot-save -no-window -verbose -noaudio
WARNING: Force to use classic engine to support snapshot.
emulator: Android virtual device file at: /var/lib/jenkins/.android/avd/hudson_en-US_160_WVGA_android-23_x86.ini
emulator: virtual device content at /var/lib/jenkins/.android/avd/hudson_en-US_160_WVGA_android-23_x86.avd
emulator: virtual device config file: /var/lib/jenkins/.android/avd/hudson_en-US_160_WVGA_android-23_x86.avd/config.ini
emulator: using core hw config path: /var/lib/jenkins/.android/avd/hudson_en-US_160_WVGA_android-23_x86.avd/hardware-qemu.ini
emulator: Found AVD target API level: 23
emulator: Read property file at /opt/android-sdk-linux/system-images/android-23/default/x86//build.prop
emulator: No boot.prop property file found.
emulator: found skin 'WVGA800' in directory: /opt/android-sdk-linux/platforms/android-23/skins/
emulator: autoconfig: -skin WVGA800
emulator: autoconfig: -skindir /opt/android-sdk-linux/platforms/android-23/skins/
emulator: found skin-specific hardware.ini: /opt/android-sdk-linux/platforms/android-23/skins//WVGA800/hardware.ini
emulator: autoconfig: -kernel /opt/android-sdk-linux/system-images/android-23/default/x86//kernel-qemu
emulator: Target arch = 'x86'
emulator: Auto-config: -qemu -cpu qemu32
emulator: Auto-detect: Kernel image requires legacy device naming scheme.
emulator: Auto-detect: Kernel does not support YAFFS2 partitions.
emulator: autoconfig: -ramdisk /opt/android-sdk-linux/system-images/android-23/default/x86//ramdisk.img
emulator: Using initial system image: /opt/android-sdk-linux/system-images/android-23/default/x86//system.img
emulator: autoconfig: -data /var/lib/jenkins/.android/avd/hudson_en-US_160_WVGA_android-23_x86.avd/userdata-qemu.img
emulator: autoconfig: -initdata /var/lib/jenkins/.android/avd/hudson_en-US_160_WVGA_android-23_x86.avd/userdata.img
emulator: autoconfig: -cache /var/lib/jenkins/.android/avd/hudson_en-US_160_WVGA_android-23_x86.avd/cache.img
emulator: autoconfig: -sdcard /var/lib/jenkins/.android/avd/hudson_en-US_160_WVGA_android-23_x86.avd/sdcard.img
emulator: Increasing RAM size to 1024MB
emulator: VM heap size 48MB is below hardware specified minimum of 192MB,setting it to that value
emulator: System image is read only
emulator: autoconfig: -snapstorage /var/lib/jenkins/.android/avd/hudson_en-US_160_WVGA_android-23_x86.avd/snapshots.img
emulator: GPU emulation is disabled
emulator: Found 2 DNS servers: 8.8.8.8 168.95.192.1
emulator: trying to load skin file '/opt/android-sdk-linux/platforms/android-23/skins//WVGA800/layout'
emulator: Found 2 DNS servers: 8.8.8.8 168.95.192.1
emulator: WARNING: Classic qemu does not support SMP. The hw.cpu.ncore option from your config file is ignored.
Content of hardware configuration file:
  hw.cpu.arch = x86
  hw.cpu.model = qemu32
  hw.cpu.ncore = 2
  hw.ramSize = 1024
  hw.screen = multi-touch
  hw.mainKeys = true
  hw.trackBall = true
  hw.keyboard = false
  hw.keyboard.lid = false
  hw.keyboard.charmap = qwerty2
  hw.dPad = true
  hw.gsmModem = true
  hw.gps = true
  hw.battery = true
  hw.accelerometer = true
  hw.audioInput = true
  hw.audioOutput = true
  hw.sdCard = true
  hw.sdCard.path = /var/lib/jenkins/.android/avd/hudson_en-US_160_WVGA_android-23_x86.avd/sdcard.img
  disk.cachePartition = true
  disk.cachePartition.path = /var/lib/jenkins/.android/avd/hudson_en-US_160_WVGA_android-23_x86.avd/cache.img
  disk.cachePartition.size = 66m
  hw.lcd.width = 480
  hw.lcd.height = 800
  hw.lcd.depth = 16
  hw.lcd.density = 160
  hw.lcd.backlight = true
  hw.gpu.enabled = false
  hw.gpu.mode = (null)
  hw.gpu.blacklisted = no
  hw.initialOrientation = portrait
  hw.camera.back = emulated
  hw.camera.front = none
  vm.heapSize = 192
  hw.sensors.light = true
  hw.sensors.pressure = true
  hw.sensors.humidity = true
  hw.sensors.proximity = true
  hw.sensors.magnetic_field = true
  hw.sensors.orientation = true
  hw.sensors.temperature = true
  hw.useext4 = true
  kernel.path = /opt/android-sdk-linux/system-images/android-23/default/x86//kernel-qemu
  kernel.newDeviceNaming = no
  kernel.supportsYaffs2 = no
  disk.ramdisk.path = /opt/android-sdk-linux/system-images/android-23/default/x86//ramdisk.img
  disk.systemPartition.initPath = /opt/android-sdk-linux/system-images/android-23/default/x86//system.img
  disk.systemPartition.size = 1280m
  disk.dataPartition.path = /var/lib/jenkins/.android/avd/hudson_en-US_160_WVGA_android-23_x86.avd/userdata-qemu.img
  disk.dataPartition.size = 2g
  disk.snapStorage.path = /var/lib/jenkins/.android/avd/hudson_en-US_160_WVGA_android-23_x86.avd/snapshots.img
  avd.name = hudson_en-US_160_WVGA_android-23_x86
.
emulator: CPU Acceleration: working
emulator: CPU Acceleration status: KVM (version 12) is installed and usable.
QEMU options list:
emulator: argv[00] = "/opt/android-sdk-linux/tools/emulator64-x86"
emulator: argv[01] = "-audio"
emulator: argv[02] = "none"
emulator: argv[03] = "-dns-server"
emulator: argv[04] = "8.8.8.8,168.95.192.1"
emulator: argv[05] = "-serial"
emulator: argv[06] = "null"
emulator: argv[07] = "-serial"
emulator: argv[08] = "null"
emulator: argv[09] = "-boot-property"
emulator: argv[10] = "persist.sys.language=en"
emulator: argv[11] = "-boot-property"
emulator: argv[12] = "persist.sys.country=US"
emulator: argv[13] = "-android-ports"
emulator: argv[14] = "5746,5747"
emulator: argv[15] = "-android-report-console"
emulator: argv[16] = "tcp:5839,max=60"
emulator: argv[17] = "-enable-kvm"
emulator: argv[18] = "-android-hw"
emulator: argv[19] = "/var/lib/jenkins/.android/avd/hudson_en-US_160_WVGA_android-23_x86.avd/hardware-qemu.ini"
emulator: argv[20] = "-append"
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"
Concatenated QEMU options:
 /opt/android-sdk-linux/tools/emulator64-x86 -audio none -dns-server 8.8.8.8,168.95.192.1 -serial null -serial null -boot-property persist.sys.language=en -boot-property persist.sys.country=US -android-ports 5746,5747 -android-report-console tcp:5839,max=60 -enable-kvm -android-hw /var/lib/jenkins/.android/avd/hudson_en-US_160_WVGA_android-23_x86.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'
emulator: Starting QEMU main loop
emulator: registered 'boot-properties' qemud service
emulator: Using kernel serial device prefix: ttyS
emulator: AVD Name: hudson_en-US_160_WVGA_android-23_x86
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: nand_add_dev: system,size=0x50000000,file=/opt/android-sdk-linux/system-images/android-23/default/x86//system.img,pagesize=512,extrasize=0,readonly
emulator: userdata partition format: ext4
emulator: nand_add_dev: userdata,size=0x80000000,file=/var/lib/jenkins/.android/avd/hudson_en-US_160_WVGA_android-23_x86.avd/userdata-qemu.img,pagesize=512,extrasize=0
emulator: cache partition format: ext4
emulator: nand_add_dev: cache,size=0x4200000,file=/var/lib/jenkins/.android/avd/hudson_en-US_160_WVGA_android-23_x86.avd/cache.img,pagesize=512,extrasize=0
emulator: Adding boot property: 'dalvik.vm.heapsize' = '192m'
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: Found 2 DNS servers: 8.8.8.8 168.95.192.1
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
emulator:     trying to find: /opt/android-sdk-linux/tools/bios.bin

emulator:     trying to find: /opt/android-sdk-linux/tools/lib/pc-bios/bios.bin

emulator:     trying to find: /opt/android-sdk-linux/tools/vgabios-cirrus.bin

emulator:     trying to find: /opt/android-sdk-linux/tools/lib/pc-bios/vgabios-cirrus.bin

emulator: Adding boot property: 'persist.sys.language' = 'en'
emulator: Adding boot property: 'persist.sys.country' = 'US'
emulator: (android_emulation_setup) using custom adb server port 5850
emulator: ro.adb.qemud invalid or not found, API >= 16, defaulting ro.adb.qemud = 0
emulator: (setup_console_and_adb_ports) trying console port 5746, adb port 5747 (legacy: true)
emulator: (android_console_start) initializing on port 5746
emulator: sent '0012host:emulator:5747' to ADB server
emulator: WARNING: Requested adb port (5747) is outside the recommended range [5555,5586]. ADB may not function properly for the emulator. See -help-port for details.
emulator: Listening for console connections on port: 5746
emulator: Serial number of this emulator (for ADB): emulator-5746
emulator: trying to find console-report client on tcp:5839
emulator: trying to find console-report client on tcp:5839
emulator: trying to find console-report client on tcp:5839
emulator: trying to find console-report client on tcp:5839
emulator: trying to find console-report client on tcp:5839
emulator: trying to find console-report client on tcp:5839
emulator: console port number sent to remote. resuming boot
[android] Emulator reported that the console is available on port 5,746
[android] Waiting for emulator to finish booting...
emulator: android_hw_fingerprint_init: fingerprint qemud listen service initialized

emulator: Skipping metrics reporting: No user opt-in.
$ /opt/android-sdk-linux/platform-tools/adb -s emulator-5746 wait-for-device shell getprop init.svc.bootanim
emulator: _hwFingerprint_connect: connect finger print listen is called

emulator: got message from guest system fingerprint HAL

[android] Emulator reported that the startup process is 'stopped'
$ /opt/android-sdk-linux/platform-tools/adb -s emulator-5746 logcat -v time
[android] Attempting to unlock emulator screen
$ /opt/android-sdk-linux/platform-tools/adb -s emulator-5746 shell wm dismiss-keyguard
$ /opt/android-sdk-linux/platform-tools/adb -s emulator-5746 shell input keyevent 4
[android] Emulator is ready for use (took 29 seconds)
[em] $ /bin/sh -xe /tmp/hudson8096686309595310732.sh
+ /opt/android-sdk-linux/platform-tools/adb devices
List of devices attached
emulator-5746   device

+ sleep 10
+ cd /var/lib/jenkins/workspace/cp_demo/CompositeApp
+ ./gradlew connectedDebugAndroidTest
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 /opt/android-sdk-linux/ndk-bundle.
If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.

WARNING: WARNING: Dependency commons-logging:commons-logging:1.1.1 is ignored for debug as it may be conflicting with the internal version provided by Android.
         In case of problem, please repackage it with jarjar to change the class packages
Unrecognized dependency: 'com.wu-man:android-oauth-client:0.4.5' (type: 'arr', extension: 'arr')
WARNING: WARNING: Dependency org.apache.httpcomponents:httpclient:4.0.1 is ignored for debug as it may be conflicting with the internal version provided by Android.
         In case of problem, please repackage it with jarjar to change the class packages
WARNING: WARNING: Dependency commons-logging:commons-logging:1.1.1 is ignored for debug as it may be conflicting with the internal version provided by Android.
         In case of problem, please repackage it with jarjar to change the class packages
Unrecognized dependency: 'com.wu-man:android-oauth-client:0.4.5' (type: 'arr', extension: 'arr')
WARNING: WARNING: Dependency org.apache.httpcomponents:httpclient:4.0.1 is ignored for debug as it may be conflicting with the internal version provided by Android.
         In case of problem, please repackage it with jarjar to change the class packages
WARNING: WARNING: Dependency commons-logging:commons-logging:1.1.1 is ignored for release as it may be conflicting with the internal version provided by Android.
         In case of problem, please repackage it with jarjar to change the class packages
Unrecognized dependency: 'com.wu-man:android-oauth-client:0.4.5' (type: 'arr', extension: 'arr')
WARNING: WARNING: Dependency org.apache.httpcomponents:httpclient:4.0.1 is ignored for release as it may be conflicting with the internal version provided by Android.
         In case of problem, please repackage it with jarjar to change the class packages
WARNING: WARNING: Dependency commons-logging:commons-logging:1.1.1 is ignored for release as it may be conflicting with the internal version provided by Android.
         In case of problem, please repackage it with jarjar to change the class packages
Unrecognized dependency: 'com.wu-man:android-oauth-client:0.4.5' (type: 'arr', extension: 'arr')
WARNING: WARNING: Dependency org.apache.httpcomponents:httpclient:4.0.1 is ignored for release as it may be conflicting with the internal version provided by Android.
         In case of problem, please repackage it with jarjar to change the class packages
Incremental java compilation is an incubating feature.
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 /opt/android-sdk-linux/ndk-bundle.
If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.

WARNING: WARNING: Dependency org.apache.httpcomponents:httpclient:4.0.1 is ignored for debug as it may be conflicting with the internal version provided by Android.
         In case of problem, please repackage it with jarjar to change the class packages
WARNING: WARNING: Dependency org.apache.httpcomponents:httpclient:4.0.1 is ignored for debug as it may be conflicting with the internal version provided by Android.
         In case of problem, please repackage it with jarjar to change the class packages
WARNING: WARNING: Dependency org.apache.httpcomponents:httpclient:4.0.1 is ignored for release as it may be conflicting with the internal version provided by Android.
         In case of problem, please repackage it with jarjar to change the class packages
WARNING: WARNING: Dependency org.apache.httpcomponents:httpclient:4.0.1 is ignored for release as it may be conflicting with the internal version provided by Android.
         In case of problem, please repackage it with jarjar to change the class packages
WARNING: WARNING: Dependency org.apache.httpcomponents:httpclient:4.0.1 is ignored for debugAndroidTest as it may be conflicting with the internal version provided by Android.
         In case of problem, please repackage it with jarjar to change the class packages
WARNING: WARNING: Dependency org.apache.httpcomponents:httpclient:4.0.1 is ignored for debugAndroidTest as it may be conflicting with the internal version provided by Android.
         In case of problem, please repackage it with jarjar to change the class packages
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72301Library
:app:prepareComAndroidSupportDesign2301Library
:app:prepareComAndroidSupportMultidex101Library
:app:preDebugAndroidTestBuild UP-TO-DATE
:app:prepareComAndroidSupportSupportV42301Library
:app:prepareComGoogleAndroidGmsPlayServicesBase840Library
:app:prepareComGoogleAndroidGmsPlayServicesBasement840Library
:app:prepareComGoogleAndroidGmsPlayServicesPlus840Library
:app:prepareCompositeAppComlibraryDebugUnspecifiedLibrary
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:processDebugManifest
:app:processDebugResources
:app:generateDebugSources
:app:incrementalDebugJavaCompilationSafeguard
:app:javaPreCompileDebug
:app:compileDebugJavaWithJavac
:app:compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
/var/lib/jenkins/workspace/cp_demo/CompositeApp/app/src/main/java/ntu/selab/lw/util/ClassUtilities.java:326: warning: non-varargs call of varargs method with inexact argument type for last parameter;
            value = valueClass.getMethod("toString", parameters).invoke(valueObj, parameters);
                                                                                  ^
  cast to Object for a varargs call
  cast to Object[] for a non-varargs call and to suppress this warning
/var/lib/jenkins/workspace/cp_demo/CompositeApp/app/src/main/java/ntu/selab/lw/util/ClassUtilities.java:335: warning: non-varargs call of varargs method with inexact argument type for last parameter;
        return beanClass.getMethod(methodName, parameters).invoke(beanObj, parameters);
                                                                           ^
  cast to Object for a varargs call
  cast to Object[] for a non-varargs call and to suppress this warning
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
2 warnings
:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources
:app:mergeDebugShaders UP-TO-DATE
:app:compileDebugShaders UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:unzipJacocoAgent UP-TO-DATE
:app:transformClassesWithJacocoForDebug
:app:transformClassesWithDexForDebug

Running dex as a separate process.

To run dex in process, the Gradle daemon needs a larger heap.
It currently has 1024 MB.
For faster builds, increase the maximum heap size for the Gradle daemon to at least 2560 MB (based on the dexOptions.javaMaxHeapSize = 2g).
To do this set org.gradle.jvmargs=-Xmx2560M in the project gradle.properties.
For more information see https://docs.gradle.org/current/userguide/build_environment.html

:app:mergeDebugJniLibFolders UP-TO-DATE
:app:transformNativeLibsWithMergeJniLibsForDebug UP-TO-DATE
:app:processDebugJavaRes UP-TO-DATE
:app:transformResourcesWithMergeJavaResForDebug UP-TO-DATE
:app:validateSigningDebug
:app:packageDebug
:app:assembleDebug
:app:prepareComAndroidSupportMultidexInstrumentation101Library
:app:prepareComAndroidSupportRecyclerviewV72301Library
:app:prepareComAndroidSupportTestEspressoEspressoContrib221Library
:app:prepareComAndroidSupportTestEspressoEspressoCore221Library
:app:prepareComAndroidSupportTestEspressoEspressoIdlingResource221Library
:app:prepareComAndroidSupportTestExposedInstrumentationApiPublish041Library
:app:prepareComAndroidSupportTestRules041Library
:app:prepareComAndroidSupportTestRunner041Library
:app:prepareDebugAndroidTestDependencies
:app:compileDebugAndroidTestAidl
:app:processDebugAndroidTestManifest
:app:compileDebugAndroidTestRenderscript
:app:generateDebugAndroidTestBuildConfig
:app:generateDebugAndroidTestResValues
:app:generateDebugAndroidTestResources
:app:mergeDebugAndroidTestResources
:app:processDebugAndroidTestResources
:app:generateDebugAndroidTestSources
:app:incrementalDebugAndroidTestJavaCompilationSafeguard
:app:javaPreCompileDebugAndroidTest
:app:compileDebugAndroidTestJavaWithJavacNote: /var/lib/jenkins/workspace/cp_demo/CompositeApp/app/src/androidTest/java/ntu/selab/lw/invoke/intent_address_extractor/OutputExtrasInputExtractorTest.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

:app:compileDebugAndroidTestNdk UP-TO-DATE
:app:compileDebugAndroidTestSources
:app:mergeDebugAndroidTestShaders
:app:compileDebugAndroidTestShaders
:app:generateDebugAndroidTestAssets
:app:mergeDebugAndroidTestAssets
:app:transformClassesWithDexForDebugAndroidTest
:app:mergeDebugAndroidTestJniLibFolders
:app:transformNativeLibsWithMergeJniLibsForDebugAndroidTest
:app:processDebugAndroidTestJavaRes UP-TO-DATE
:app:transformResourcesWithMergeJavaResForDebugAndroidTest
:app:validateSigningDebugAndroidTest
:app:packageDebugAndroidTest
:app:assembleDebugAndroidTest
:app:connectedDebugAndroidTest FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:connectedDebugAndroidTest'.
> com.android.builder.testing.api.DeviceException: No connected devices!

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 5.205 secs
Build step 'Execute shell' marked build as failure
[android] Stopping Android emulator
[android] Archiving emulator log
$ /opt/android-sdk-linux/platform-tools/adb kill-server
Finished: FAILURE

构建日志显示我的模拟器成功启动,有人没有原因吗?

由于

0 个答案:

没有答案
相关问题