I am trying to set up my mobile automation pack in Jenkins. As a first step, when I try to launch a emulator using Jenkins Android Emulator plugin, I am getting below error
Job Config
Android SDK details
Below is the error
$ C:\Users\Divakar\AppData\Local\Android\sdk/platform-tools/adb.exe start-server
[android] Snapshots are enabled, but cannot be used as they are not supported by the current SDK Tools
[android] Starting Android emulator
[android] Erasing existing emulator data...
$ C:\Users\Divakar\AppData\Local\Android\sdk/emulator/emulator.exe -ports 5764,5765 -report-console tcp:5850,max=60 -avd Pixel_2_Pie_9.0 -wipe-data -no-window
Failed to open /qemu.conf, err: 2
HAX is working and emulator runs in fast virt mode.
dsound: Could not set cooperative level for window 0000000000000000
dsound: Reason: An invalid parameter was passed to the returning function
audio: Could not init `dsound' audio driver
emulator: WARNING: Requested adb port (5765) is outside the recommended range [5555,5586]. ADB may not function properly for the emulator. See -help-port for details.
[android] Emulator reported that the console is available on port 5,764
[android] Waiting for emulator to finish booting...
$ C:\Users\Divakar\AppData\Local\Android\sdk/platform-tools/adb.exe -s emulator-5764 wait-for-device shell getprop dev.bootcomplete
ERROR: Timeout after 90000 milliseconds
$ C:\Users\Divakar\AppData\Local\Android\sdk/platform-tools/adb.exe -s emulator-5764 wait-for-device shell getprop dev.bootcomplete
emulator: INFO: boot completed
emulator: Increasing screen off timeout, logcat buffer size to 2M.
emulator: Revoking microphone permissions for Google App.
ERROR: Timeout after 90000 milliseconds
$ C:\Users\Divakar\AppData\Local\Android\sdk/platform-tools/adb.exe -s emulator-5764 wait-for-device shell getprop dev.bootcomplete
ERROR: Timeout after 90000 milliseconds
$ C:\Users\Divakar\AppData\Local\Android\sdk/platform-tools/adb.exe -s emulator-5764 wait-for-device shell getprop dev.bootcomplete
ERROR: Timeout after 90000 milliseconds
$ C:\Users\Divakar\AppData\Local\Android\sdk/platform-tools/adb.exe -s emulator-5764 wait-for-device shell getprop dev.bootcomplete
ERROR: Timeout after 90000 milliseconds
$ C:\Users\Divakar\AppData\Local\Android\sdk/platform-tools/adb.exe -s emulator-5764 wait-for-device shell getprop dev.bootcomplete
ERROR: Timeout after 90000 milliseconds
$ C:\Users\Divakar\AppData\Local\Android\sdk/platform-tools/adb.exe -s emulator-5764 wait-for-device shell getprop dev.bootcomplete
ERROR: Timeout after 90000 milliseconds
[android] Timed-out after waiting 720 seconds for emulator
[android] Stopping Android emulator
$ C:\Users\Divakar\AppData\Local\Android\sdk/platform-tools/adb.exe kill-server
emulator: Saving state on exit with session uptime 730379 ms
Finished: NOT_BUILT
After reducing the emulator RAM to 768MB, I can rid off the above issue. However I cant see any devices connected in adb devices command. If you see the below log, it started and immediately stopped.
Building in workspace C:\Program Files\Jenkins\Jenkins.jenkins\workspace\AVD_Manager_Start_Emulator
[android] Failed to create file or directory: C:\WINDOWS\system32\config\systemprofile\.android
[android] Using Android SDK: C:\Users\Divakar\AppData\Local\Android\sdk
$ C:\Users\Divakar\AppData\Local\Android\sdk/platform-tools/adb.exe start-server
* daemon not running; starting now at tcp:5813
* daemon started successfully
$ C:\Users\Divakar\AppData\Local\Android\sdk/platform-tools/adb.exe start-server
[android] Snapshots are enabled, but cannot be used as they are not supported by the current SDK Tools
[android] Starting Android emulator
[android] Erasing existing emulator data...
$ C:\Users\Divakar\AppData\Local\Android\sdk/emulator/emulator.exe -ports 5754,5755 -report-console tcp:5838,max=60 -avd Pixel_2_Pie_9.0 -wipe-data -no-window
Failed to open /qemu.conf, err: 2
HAX is working and emulator runs in fast virt mode.
dsound: Could not set cooperative level for window 0000000000000000
dsound: Reason: An invalid parameter was passed to the returning function
audio: Could not init `dsound' audio driver
emulator: WARNING: Requested adb port (5755) is outside the recommended range [5555,5586]. ADB may not function properly for the emulator. See -help-port for details.
[android] Emulator reported that the console is available on port 5,754
[android] Waiting for emulator to finish booting...
$ C:\Users\Divakar\AppData\Local\Android\sdk/platform-tools/adb.exe -s emulator-5754 wait-for-device shell getprop dev.bootcomplete
[android] Emulator reported that the startup process is ''
$ C:\Users\Divakar\AppData\Local\Android\sdk/platform-tools/adb.exe -s emulator-5754 wait-for-device shell getprop dev.bootcomplete
[android] Emulator reported that the startup process is ''
$ C:\Users\Divakar\AppData\Local\Android\sdk/platform-tools/adb.exe -s emulator-5754 wait-for-device shell getprop dev.bootcomplete
[android] Emulator reported that the startup process is ''
$ C:\Users\Divakar\AppData\Local\Android\sdk/platform-tools/adb.exe -s emulator-5754 wait-for-device shell getprop dev.bootcomplete
[android] Emulator reported that the startup process is ''
$ C:\Users\Divakar\AppData\Local\Android\sdk/platform-tools/adb.exe -s emulator-5754 wait-for-device shell getprop dev.bootcomplete
[android] Emulator reported that the startup process is ''
$ C:\Users\Divakar\AppData\Local\Android\sdk/platform-tools/adb.exe -s emulator-5754 wait-for-device shell getprop dev.bootcomplete
[android] Emulator reported that the startup process is ''
$ C:\Users\Divakar\AppData\Local\Android\sdk/platform-tools/adb.exe -s emulator-5754 wait-for-device shell getprop dev.bootcomplete
[android] Emulator reported that the startup process is ''
$ C:\Users\Divakar\AppData\Local\Android\sdk/platform-tools/adb.exe -s emulator-5754 wait-for-device shell getprop dev.bootcomplete
[android] Emulator reported that the startup process is ''
$ C:\Users\Divakar\AppData\Local\Android\sdk/platform-tools/adb.exe -s emulator-5754 wait-for-device shell getprop dev.bootcomplete
[android] Emulator reported that the startup process is ''
$ C:\Users\Divakar\AppData\Local\Android\sdk/platform-tools/adb.exe -s emulator-5754 wait-for-device shell getprop dev.bootcomplete
[android] Emulator reported that the startup process is ''
$ C:\Users\Divakar\AppData\Local\Android\sdk/platform-tools/adb.exe -s emulator-5754 wait-for-device shell getprop dev.bootcomplete
[android] Emulator reported that the startup process is ''
$ C:\Users\Divakar\AppData\Local\Android\sdk/platform-tools/adb.exe -s emulator-5754 wait-for-device shell getprop dev.bootcomplete
[android] Emulator reported that the startup process is ''
$ C:\Users\Divakar\AppData\Local\Android\sdk/platform-tools/adb.exe -s emulator-5754 wait-for-device shell getprop dev.bootcomplete
[android] Emulator reported that the startup process is ''
$ C:\Users\Divakar\AppData\Local\Android\sdk/platform-tools/adb.exe -s emulator-5754 wait-for-device shell getprop dev.bootcomplete
[android] Emulator reported that the startup process is ''
$ C:\Users\Divakar\AppData\Local\Android\sdk/platform-tools/adb.exe -s emulator-5754 wait-for-device shell getprop dev.bootcomplete
[android] Emulator reported that the startup process is ''
$ C:\Users\Divakar\AppData\Local\Android\sdk/platform-tools/adb.exe -s emulator-5754 wait-for-device shell getprop dev.bootcomplete
[android] Emulator reported that the startup process is ''
$ C:\Users\Divakar\AppData\Local\Android\sdk/platform-tools/adb.exe -s emulator-5754 wait-for-device shell getprop dev.bootcomplete
[android] Emulator reported that the startup process is ''
emulator: INFO: boot completed
emulator: Increasing screen off timeout, logcat buffer size to 2M.
emulator: Revoking microphone permissions for Google App.
$ C:\Users\Divakar\AppData\Local\Android\sdk/platform-tools/adb.exe -s emulator-5754 wait-for-device shell getprop dev.bootcomplete
[android] Emulator reported that the startup process is '1'
$ C:\Users\Divakar\AppData\Local\Android\sdk/platform-tools/adb.exe -s emulator-5754 shell logcat -v time
[android] Emulator is ready for use (took 283 seconds)
[AVD_Manager_Start_Emulator] $ cmd /c call C:\WINDOWS\TEMP\jenkins8495526174755772173.bat
C:\Program Files\Jenkins\Jenkins.jenkins\workspace\AVD_Manager_Start_Emulator>exit 0
[android] Stopping Android emulator
emulator: Saving state on exit with session uptime 257552 ms
[android] Archiving emulator log
$ C:\Users\Divakar\AppData\Local\Android\sdk/platform-tools/adb.exe kill-server
Finished: SUCCESS
The issue has been resolved. Please find the steps that I have followed
Uninstall Jenkins
Install war file
Thats all
Problem: when I try to build an android project on Jenkins, emulator occasionally hangs indefinitely on startup and the job finished: NOT_BUILT.
I have Jenkins slaves running on Debian EC2 instances - not using any emulator snapshots, every run is fresh with a clean workspace, so I haven't been able to figure out the difference as to why sometimes they are starting correctly and more often not.
In "Common emulator options", I checked the option: 'Reset emulator state at start-up'.
Jenkins version: 1.642
Android Emulator Plugin: 2.13.1
...
[android] Using Android SDK: /var/lib/jenkins/tools/android-sdk
[android] Creating Android AVD: /var/lib/jenkins/.android/avd/hudson_it-IT_160_HVGA_android-22_armeabi-v7a.avd
[android] /var/lib/jenkins/tools/android-sdk/tools/android create avd -f -a -s HVGA -n hudson_it-IT_160_HVGA_android-22_armeabi-v7a -t android-22 --abi armeabi-v7a
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb start-server
* daemon not running. starting it now on port 6345 *
* daemon started successfully *
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb start-server
[android] Starting Android emulator
$ /var/lib/jenkins/tools/android-sdk/tools/emulator -ports 6343,6344 -prop persist.sys.language=it -prop persist.sys.country=IT -avd hudson_it-IT_160_HVGA_android-22_armeabi-v7a -no-snapshot-load -no-snapshot-save -wipe-data -no-window
resize2fs 1.42.13 (17-May-2015)
The filesystem is already 140800 (4k) blocks long. Nothing to do!
emulator: WARNING: Increasing RAM size to 1GB
Creating filesystem with parameters:
Size: 576716800
Block size: 4096
Blocks per group: 32768
Inodes per group: 7040
Inode size: 256
Journal blocks: 2200
Label:
Blocks: 140800
Block groups: 5
Reserved block group size: 39
Created filesystem with 11/35200 inodes and 4536/140800 blocks
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: warning: opening audio output failed
emulator: UpdateChecker: skipped version check
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:6344
connected to localhost:6344
[android] Waiting for emulator to finish booting...
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:6344 shell getprop init.svc.bootanim
error: device offline
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:6344
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:6344 shell getprop init.svc.bootanim
error: device offline
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:6344
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:6344 shell getprop init.svc.bootanim
error: device offline
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb disconnect localhost:6344
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:6344
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:6344 shell getprop init.svc.bootanim
error: device offline
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:6344
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:6344 shell getprop init.svc.bootanim
error: device offline
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:6344
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:6344 shell getprop init.svc.bootanim
error: device offline
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb disconnect localhost:6344
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:6344
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:6344 shell getprop init.svc.bootanim
error: device offline
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:6344
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:6344 shell getprop init.svc.bootanim
error: device offline
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:6344
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:6344 shell getprop init.svc.bootanim
error: device offline
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb disconnect localhost:6344
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:6344
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:6344 shell getprop init.svc.bootanim
error: device offline
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:6344
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:6344 shell getprop init.svc.bootanim
error: device offline
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:6344
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:6344 shell getprop init.svc.bootanim
error: device offline
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb disconnect localhost:6344
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:6344
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:6344 shell getprop init.svc.bootanim
error: device offline
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:6344
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:6344 shell getprop init.svc.bootanim
error: device offline
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:6344
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:6344 shell getprop init.svc.bootanim
error: device offline
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb disconnect localhost:6344
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:6344
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:6344 shell getprop init.svc.bootanim
error: device offline
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:6344
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:6344 shell getprop init.svc.bootanim
error: device offline
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:6344
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:6344 shell getprop init.svc.bootanim
error: device offline
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb disconnect localhost:6344
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:6344
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:6344 shell getprop init.svc.bootanim
error: device offline
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:6344
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:6344 shell getprop init.svc.bootanim
error: device offline
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:6344
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:6344 shell getprop init.svc.bootanim
error: device offline
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb disconnect localhost:6344
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:6344
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:6344 shell getprop init.svc.bootanim
error: device offline
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:6344
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:6344 shell getprop init.svc.bootanim
error: device offline
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:6344
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:6344 shell getprop init.svc.bootanim
error: device offline
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb disconnect localhost:6344
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:6344
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:6344 shell getprop init.svc.bootanim
error: device offline
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:6344
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:6344 shell getprop init.svc.bootanim
error: device offline
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:6344
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:6344 shell getprop init.svc.bootanim
error: device offline
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb disconnect localhost:6344
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:6344
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:6344 shell getprop init.svc.bootanim
error: device offline
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:6344
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:6344 shell getprop init.svc.bootanim
error: device offline
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:6344
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:6344 shell getprop init.svc.bootanim
error: device offline
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb disconnect localhost:6344
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:6344
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:6344 shell getprop init.svc.bootanim
error: device offline
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:6344
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:6344 shell getprop init.svc.bootanim
error: device offline
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:6344
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:6344 shell getprop init.svc.bootanim
error: device offline
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb disconnect localhost:6344
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:6344
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:6344 shell getprop init.svc.bootanim
error: device offline
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:6344
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:6344 shell getprop init.svc.bootanim
error: device offline
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:6344
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:6344 shell getprop init.svc.bootanim
error: device offline
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb disconnect localhost:6344
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:6344
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:6344 shell getprop init.svc.bootanim
error: device offline
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:6344
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:6344 shell getprop init.svc.bootanim
error: device offline
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:6344
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:6344 shell getprop init.svc.bootanim
error: device offline
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb disconnect localhost:6344
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:6344
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:6344 shell getprop init.svc.bootanim
error: device offline
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:6344
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:6344 shell getprop init.svc.bootanim
error: device offline
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:6344
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:6344 shell getprop init.svc.bootanim
error: device offline
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb disconnect localhost:6344
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:6344
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:6344 shell getprop init.svc.bootanim
error: device offline
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:6344
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:6344 shell getprop init.svc.bootanim
error: device offline
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:6344
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:6344 shell getprop init.svc.bootanim
error: device offline
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb disconnect localhost:6344
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:6344
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:6344 shell getprop init.svc.bootanim
error: device offline
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:6344
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:6344 shell getprop init.svc.bootanim
error: device offline
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:6344
[android] Timed-out after waiting 720 seconds for emulator
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb disconnect localhost:6344
[android] Stopping Android emulator
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb kill-server
Finished: NOT_BUILT
Can Someone help me? Where and what is the problem?
Thank to all.
I'm trying to install an .apk to AVD but the process just hangs with message - waiting for device -.
Here's how I'm starting the emulator itself and connecting to it:
$ /opt/android-sdk-linux/tools/emulator-arm -no-boot-anim -ports 5851,5852 -prop persist.sys.language=en -prop persist.sys.country=US -avd hudson_en-US_160_WVGA_android-22_armeabi-v7a_myapp -no-snapshot-load -no-snapshot-save -no-window -force-32bit -noaudio -gpu off
Failed to Initialize backend EGL display
$ /opt/android-sdk-linux/platform-tools/adb connect emulator-5851
[android] Waiting for emulator to finish booting...
$ /opt/android-sdk-linux/platform-tools/adb -s emulator-5851 shell getprop init.svc.bootanim
error: device offline
$ /opt/android-sdk-linux/platform-tools/adb connect localhost:5851
$ /opt/android-sdk-linux/platform-tools/adb -s emulator-5851 shell getprop init.svc.bootanim
error: device offline
$ /opt/android-sdk-linux/platform-tools/adb connect localhost:5851
$ /opt/android-sdk-linux/platform-tools/adb -s emulator-5851 shell getprop init.svc.bootanim
$ /opt/android-sdk-linux/platform-tools/adb -s emulator-5851 logcat -v time
[android] Attempting to unlock emulator screen
$ /opt/android-sdk-linux/platform-tools/adb -s emulator-5851 shell input keyevent 82
$ /opt/android-sdk-linux/platform-tools/adb -s emulator-5851 shell input keyevent 4
[android] Emulator is ready for use (took 47 seconds)
/opt/android-sdk-linux/platform-tools/adb connect emulator-5851
$ /opt/android-sdk-linux/platform-tools/adb -s emulator-5584 install -r myapp-debug-unaligned.apk
error: device not found
- waiting for device -
When I'm trying to run AVD for older android version, it works fine.
I have Jenkins 1.568 installed on a Macbook Air running Ubuntu 14.04. I have the android emulator plugin installed, and the configuration I have set up runs the emulator in -no-window mode before starting each build.
About half of the builds are fine, but the other half, I get the following on the console:
[android] Starting Android emulator
$ /usr/local/src/android/android-sdk-linux/tools/emulator -no-boot-anim -ports 5782,5783 -avd Caesar -no-snapshot-load -no-snapshot-save -no-window -no-audio -no-skin -no-window
* daemon not running. starting it now on port 5784 *
* daemon started successfully *
Failed to Initialize backend EGL display
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
[android] Waiting for emulator to finish booting...
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb disconnect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb disconnect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb disconnect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb disconnect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb disconnect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb disconnect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb disconnect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb disconnect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb disconnect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb disconnect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb disconnect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb disconnect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb -s emulator-5782 shell getprop dev.bootcomplete
error: device offline
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb connect emulator-5782
[android] Timed-out after waiting 360 seconds for emulator
$ /usr/local/src/android/android-sdk-linux/platform-tools/adb disconnect emulator-5782
[android] Stopping Android emulator
Clearly, the emulator is failing about 50% of the time. I'm not sure why, though, or how to fix it. Any suggestions would be welcome as to how I can get this running and not have to restart failed builds using naginator.
Try to update Java. I had android emulator problems in the past and a Java update fixed them.
Timeout problems.
DdmPreferences.setTimeOut is the global adb read/write packet timeout setting.
In 'at com.android.ddmlib.SyncService.doPushFile(SyncService.java:671)', DdmPreferences.getTimeOut() is called and used to set timeout.
In build.gradle:
android{
...
adbOptions {
timeOutInMs 10 * 60 * 1000 // 10 minutes
}
}
For Eclipse (Preferences -> Android -> DDMS).
Also, this is an environment variable that you set outside of build.gradle. On Ubuntu for instance:
$ export ADB_INSTALL_TIMEOUT=5
$ ./gradlew installDebug
Between runs:
sudo adb kill-server
and
sudo adb start-server
Here is a checklist to help:
1) You need the --all flag for both android list and android update sdk, otherwise some packages will not be installed: ex for SDK 24
1a)$ANDROID_HOME/tools/android list sdk --all
1b)
(for i in {1..100}; do echo y; sleep 1; done) |
$ANDROID_HOME/tools/android update sdk --no-ui --all --filter
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,20,21,22,23,24,25,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,79,80,81,82,82,84,85,101,102,103,112,113,117,118,119,120,121,122,123,124
if you get the dreaded /home/jenkins/android-sdk-linux/platform-tools/adb -s emulator-XXXX shell getprop dev.bootcomplete error: device offline error, you are likely missing a package in step 1b
2)Ignore the dreaded Failed to Initialize backend EGL display error, it is a red herring
3)Be sure to use the Advanced Emulator options:
Emulator Options: -no-audio -gpu off
Emulator executable: emulator64-arm
Startup delay: 10 -- this *may* help
4)a pre-build script ${ANDROID_HOME}/platform-tools/adb kill-server can't hurt
check out Jenkins site https://issues.jenkins-ci.org/browse/JENKINS-27456
https://issues.jenkins-ci.org/browse/JENKINS-11952
you can also check this one https://code.google.com/p/android/issues/detail?id=209955 and http://www.yzjingying.net/4855150152.htm
Good luck!
I just found solution Android Emulator Plugin Failed to Initialize backend EGL display
Compare your job configuration with https://partnerdemo.ci.cloudbees.com/job/Android-dev/job/stockfish-android-cloud/, paying particular attention to the following settings:
Inject env var: LD_LIBRARY_PATH=/opt/android/android-sdk-linux/tool/lib
Target ABI: armeabi-v7a
Advanced -> Emulator Options: -no-audio -gpu off
Advanced -> Emulator Executable: emulator64-arm
I hope its helps you.
I've managed to get the Android Emulator plugin setup and working on Jenkins. However, my problem is that it times out after 3 minutes. I am only running it on a very slow nettop Linux box (intel atom) so I imagine it will take MUCH longer to start the emulator.
Is there a way to extend the timeout? It looks like the emulator is starting; For the first few polls, its it reported as offline, then not.
My console output is below.
Thanks
Started by user Si Pickles
[EnvInject] - Loading node environment variables.
Building in workspace /var/lib/jenkins/jobs/mycompany_myapp/workspace
Updating svn://localhost/mycompany/code/trunk/myappProject at revision '2013-08-11T23:03:06.957 +0100'
At revision 98
no change for svn://localhost/mycompany/code/trunk/myappProject since the previous build
$ /var/lib/jenkins/tools/android-sdk/tools/android list target
[android] Using Android SDK: /var/lib/jenkins/tools/android-sdk
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb start-server
[android] Starting Android emulator
$ /var/lib/jenkins/tools/android-sdk/tools/emulator -no-boot-anim -ports 48437,50001 -avd google17 -no-snapshot-load -no-snapshot-save -no-window -no-audio
* daemon not running. starting it now on port 51447 *
* daemon started successfully *
Failed to Initialize backend EGL display
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:50001
[android] Waiting for emulator to finish booting...
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:50001 shell getprop dev.bootcomplete
error: device offline
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:50001
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:50001 shell getprop dev.bootcomplete
error: device offline
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:50001
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:50001 shell getprop dev.bootcomplete
error: device offline
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb disconnect localhost:50001
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:50001
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:50001 shell getprop dev.bootcomplete
error: device offline
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:50001
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:50001 shell getprop dev.bootcomplete
error: device offline
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:50001
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:50001 shell getprop dev.bootcomplete
error: device offline
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb disconnect localhost:50001
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:50001
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:50001 shell getprop dev.bootcomplete
error: device offline
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:50001
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:50001 shell getprop dev.bootcomplete
error: device offline
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:50001
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:50001 shell getprop dev.bootcomplete
error: device offline
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb disconnect localhost:50001
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:50001
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:50001 shell getprop dev.bootcomplete
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:50001
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:50001 shell getprop dev.bootcomplete
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:50001
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:50001 shell getprop dev.bootcomplete
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb disconnect localhost:50001
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:50001
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:50001 shell getprop dev.bootcomplete
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:50001
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:50001 shell getprop dev.bootcomplete
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:50001
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:50001 shell getprop dev.bootcomplete
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb disconnect localhost:50001
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:50001
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:50001 shell getprop dev.bootcomplete
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:50001
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:50001 shell getprop dev.bootcomplete
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:50001
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:50001 shell getprop dev.bootcomplete
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb disconnect localhost:50001
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:50001
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:50001 shell getprop dev.bootcomplete
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:50001
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:50001 shell getprop dev.bootcomplete
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:50001
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:50001 shell getprop dev.bootcomplete
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb disconnect localhost:50001
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:50001
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:50001 shell getprop dev.bootcomplete
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:50001
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:50001 shell getprop dev.bootcomplete
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:50001
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:50001 shell getprop dev.bootcomplete
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb disconnect localhost:50001
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:50001
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb -s localhost:50001 shell getprop dev.bootcomplete
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb connect localhost:50001
[android] Timed-out after waiting 180 seconds for emulator
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb disconnect localhost:50001
[android] Stopping Android emulator
emulator: WARNING: Could not initialize OpenglES emulation, using software renderer.
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb kill-server
Archiving artifacts
Finished: NOT_BUILT
Which android OS version are you trying to use?
If you are using anything higher than Android 2.2 or 2.3.3 I would recommend changing your Android OS version to these because they boot up much faster.
Also, if you click the Advanced... button located under the "Common emulator options" header on the Jenkins configure page you could try playing around with setting up a Startup delay. This might help if your build requires a lot of processing before actually using the emulator for anything.
Apologies for the hybrid Answer/Comment, I would have just commented if I had the rep.
Solution: Use a hardware device.