我有一台运行Jenkins CI 2.7.4的Mac Mini服务器,并且已经设置了一个工作来构建我的Android项目。该作业还通过Android Emulator插件运行模拟器,以运行一些Espresso测试。但是,我正在遇到模拟器从未实际启动的问题。我选中了“显示模拟器窗口”选项。
这是输出:
[android] Using Android SDK: /Users/Shared/Jenkins/Home/tools/android-sdk
[android] Adding 128M SD card to AVD 'hudson_en-US_120_WXGA720_android-23_x86'...
$ /Users/Shared/Jenkins/Home/tools/android-sdk/platform-tools/adb start-server
* daemon not running. starting it now on port 5832 *
* daemon started successfully *
$ /Users/Shared/Jenkins/Home/tools/android-sdk/platform-tools/adb start-server
$ /Users/Shared/Jenkins/Home/tools/android-sdk/tools/emulator -snapshot-list -no-window -avd hudson_en-US_120_WXGA720_android-23_x86
_RegisterApplication(), FAILED TO establish the default connection to the WindowServer, _CGSDefaultConnection() is NULL.
WARNING: Force to use classic engine to support snapshot.
_RegisterApplication(), FAILED TO establish the default connection to the WindowServer, _CGSDefaultConnection() is NULL.
[android] Starting Android emulator and creating initial snapshot
[android] Erasing existing emulator data...
$ /Users/Shared/Jenkins/Home/tools/android-sdk/tools/emulator -engine classic -ports 5730,5731 -report-console tcp:5852,max=60 -prop persist.sys.language=en -prop persist.sys.country=US -avd hudson_en-US_120_WXGA720_android-23_x86 -no-snapshot-load -no-snapshot-save -wipe-data
_RegisterApplication(), FAILED TO establish the default connection to the WindowServer, _CGSDefaultConnection() is NULL.
WARNING: Force to use classic engine to support snapshot.
_RegisterApplication(), FAILED TO establish the default connection to the WindowServer, _CGSDefaultConnection() is NULL.
2016-09-27 14:31:02.344 emulator64-x86[981:7440] CFPasteboardRef CFPasteboardCreate(CFAllocatorRef, CFStringRef) : failed to create global data
PasteBoard: Error creating pasteboard: com.apple.pasteboard.clipboard [-4960]
2016-09-27 14:31:02.344 emulator64-x86[981:7440] CFPasteboardRef CFPasteboardCreate(CFAllocatorRef, CFStringRef) : failed to create global data
PasteBoard: Error creating pasteboard: com.apple.pasteboard.find [-4960]
no screens available, assuming 24-bit color
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextTranslateCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextScaleCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextScaleCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextSetFillColorWithColor: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextFillRects: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
QPaintDevice::metrics: Device has no metric information
QPaintDevice::metrics: Device has no metric information
QPaintDevice::metrics: Device has no metric information
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextTranslateCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextScaleCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextGetCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextConcatCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextConcatCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextSaveGState: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextGetCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextGetDefaultUserSpaceToDeviceSpaceTransform: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextRestoreGState: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextTranslateCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextScaleCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextGetCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextConcatCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextConcatCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextSaveGState: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextGetCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextGetDefaultUserSpaceToDeviceSpaceTransform: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextRestoreGState: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextTranslateCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextScaleCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextGetCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextConcatCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextConcatCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextSaveGState: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextGetCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextGetDefaultUserSpaceToDeviceSpaceTransform: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextRestoreGState: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextTranslateCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextScaleCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextGetCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextConcatCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextConcatCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextSaveGState: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextGetCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextGetDefaultUserSpaceToDeviceSpaceTransform: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextRestoreGState: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextTranslateCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextScaleCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextGetCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextConcatCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextConcatCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextSaveGState: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextGetCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextGetDefaultUserSpaceToDeviceSpaceTransform: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextRestoreGState: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextTranslateCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextScaleCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextGetCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextConcatCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextConcatCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextSaveGState: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextGetCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextGetDefaultUserSpaceToDeviceSpaceTransform: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextRestoreGState: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextTranslateCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextScaleCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextGetCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextConcatCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextConcatCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextSaveGState: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextGetCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextGetDefaultUserSpaceToDeviceSpaceTransform: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextRestoreGState: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextTranslateCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextScaleCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextGetCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextConcatCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextConcatCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextSaveGState: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextGetCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextGetDefaultUserSpaceToDeviceSpaceTransform: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Sep 27 14:31:02 emulator64-x86[981] <Error>: CGContextRestoreGState: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Cannot create window: no screens available
emulator: WARNING: Classic qemu does not support SMP. The hw.cpu.ncore option from your config file is ignored.
[android] Emulator did not appear to start; giving up
[android] Stopping Android emulator
$ /Users/Shared/Jenkins/Home/tools/android-sdk/platform-tools/adb kill-server
Finished: NOT_BUILT
如果取消选中“显示模拟器窗口”,我会收到超时错误:
$ /Users/Shared/Jenkins/Home/tools/android-sdk/platform-tools/adb -s emulator-5752 wait-for-device shell getprop init.svc.bootanim
[android] Emulator reported that the startup process is 'running'
$ /Users/Shared/Jenkins/Home/tools/android-sdk/platform-tools/adb -s emulator-5752 wait-for-device shell getprop init.svc.bootanim
[android] Emulator reported that the startup process is 'running'
$ /Users/Shared/Jenkins/Home/tools/android-sdk/platform-tools/adb -s emulator-5752 wait-for-device shell getprop init.svc.bootanim
[android] Emulator reported that the startup process is 'running'
$ /Users/Shared/Jenkins/Home/tools/android-sdk/platform-tools/adb -s emulator-5752 wait-for-device shell getprop init.svc.bootanim
[android] Emulator reported that the startup process is 'running'
$ /Users/Shared/Jenkins/Home/tools/android-sdk/platform-tools/adb -s emulator-5752 wait-for-device shell getprop init.svc.bootanim
[android] Emulator reported that the startup process is 'running'
[android] Timed-out after waiting 360 seconds for emulator
[android] Stopping Android emulator
$ /Users/Shared/Jenkins/Home/tools/android-sdk/platform-tools/adb kill-server
Finished: NOT_BUILT
答案 0 :(得分:1)
尝试增加超时时间。我有类似的情况,直到我这样做才解决。
com.android.ddmlib.DdmPreferences.setTimeOut(600000)
android {
}
添加环境属性ADB_INSTALL_TIMEOUT = 5