2016-09-27 3 views
0

У меня есть сервер Mac Mini с запуском Jenkins CI 2.7.4 и задание, настроенное для сборки моего проекта Android. Задание также запускает эмулятор через плагин Android Emulator для запуска некоторых тестов Espresso. Тем не менее, я столкнулся с проблемой, когда эмулятор никогда не запускается. У меня есть опция «Показать окно эмулятора».Jenkins CI - Android-эмулятор не запускается

Вот результат:

[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

Похоже, вы пытаетесь запустить эмулятор обезглавленный, т.е. не на вошедшего в сессии UI? Работает ли это без «Показать окно эмулятора»? –

ответ

1

Попробуйте увеличить время ожидания. У меня была подобная ситуация, и я не смог ее решить, пока не сделал это.

com.android.ddmlib.DdmPreferences.setTimeOut(600000) 
android { 
} 

И добавить среда свойство ADB_INSTALL_TIMEOUT = 5

+1

Это, похоже, не работает для меня. Я попытался скопировать команду и запустить ее в окне терминала, но все равно не повезло. Появится окно загрузки Android-эмулятора Android, но в итоге оно заканчивается. Однако, если я удаляю «-report-console tcp: 5855, max = 60» из команды, тогда я могу заставить ее работать в терминале. Есть ли способ переопределить общую команду и параметры в плагине Android Emulator? – Zac

+0

'-report-console' не полезен с терминала, но он работает из плагина (в противном случае вы не смогли бы дойти до того, как« Эмулятор »сообщил, что процесс запуска« работает »). Вы можете добавить дополнительные параметры (в разделе «Дополнительно»), но вы можете удалить существующие из командной строки, используемые плагином. –

+0

@ChristopherOrr, я смог получить его в рабочем состоянии, просто удалив и переустановив Jenkins CI. Он по-прежнему показывает '_RegisterApplication(), FAILED, чтобы установить соединение по умолчанию с ошибками WindowServer', но пока я не проверю опцию« Показывать окно эмулятора », тогда он будет успешно создавать и запускать мои задания Espresso. – Zac

Смежные вопросы