I am trying to explore and use the Jenkins Android Emulator plugin in order to run my emulator within a CI environment. I have so far tried 3 different methods but none of them is able to run the emulator
Method 1:Using an existing emulator
Screenshot of the first method
In the job's configuration , Select Run an Android emulator during build, then Run existing emulator. In the AVD name I insert Nexus5X_6_8664 then Jenkins is able to find it.
When i run the job it gives me the following error :
Started by user Amine
Building in workspace D:\jenkins\workspace\Emulator
[android] Using Android SDK: D:\Tools\Dev\sdk\
$ D:\Tools\Dev\sdk\/platform-tools/adb.exe start-server
* daemon not running. starting it now at tcp:5857 *
* daemon started successfully *
$ D:\Tools\Dev\sdk\/platform-tools/adb.exe start-server
[android] Starting Android emulator
$ D:\Tools\Dev\sdk\/tools/emulator.exe -engine classic -ports 5768,5769 -report-console tcp:5833,max=60 -avd Nexus5X_6_8664 -no-snapshot-load -no-snapshot-save
init: Could not find wglGetExtensionsStringARB!
getGLES2ExtensionString: Could not find GLES 2.x config!
Failed to obtain GLES 2.x extensions string!
Could not initialize emulated framebuffer
emulator: device fd:964
HAXM is working and emulator runs in fast virt mode
emulator: WARNING: Requested adb port (5769) 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 768
[android] Waiting for emulator to finish booting...
$ D:\Tools\Dev\sdk\/platform-tools/adb.exe -s emulator-5768 wait-for-device shell getprop init.svc.bootanim
emulator: ERROR: Could not initialize OpenglES emulation, use '-gpu off' to disable it.
ERROR: Timeout after 45000 milliseconds
$ D:\Tools\Dev\sdk\/platform-tools/adb.exe kill-server
Finished: NOT_BUILT
More details :
I have increased VMHeap, changed graphics to automatic, Hardware GLES 2.0 or Software GLES 2.0 (as in Android emulator: could not get wglGetExtensionsStringARB error or could not find wglGetExtensionsStringARB)
I have Tried many screen resolutions
I have added window.x = 0 window.y = 0 to @Nexus5X_6_8664.ini
Method 2:Creating a new emulator
Screenshot of the second method
In the job's configuration , Select "Run an Android emulator during build", then "Run emulator with properties" :
- Android OS version : android-23
- Screen density : hdpi
- Screen resolutions : 480x800
- Device locale : en_US
- SD card size : 64M
- Target ABI : x86_64
- Emulator name suffix
When i run the job it gives me the following error :
Started by user Amine
Building in workspace D:\jenkins\workspace\Emulator
[android] Using Android SDK: D:\Tools\Dev\sdk\
[android] Creating Android AVD: C:\Users\Amine\.android\avd\hudson_en-US_240_WVGA_android-23_x86_64_mySuffix.avd
[android] D:\Tools\Dev\sdk\/tools/android.bat create avd -f -a -c 64M -s WVGA800 -n hudson_en-US_240_WVGA_android-23_x86_64_mySuffix -t android-23 --abi x86_64
[android] Could not create Android emulator: Failed to parse AVD config file
Finished: NOT_BUILT
When i run the same command above on my command line manually to investigate te errors it gives the following error :
Error: Flag '-s' is not valid for 'create avd'.
I try to remove -s
and then -t
then it requests :
Error: Package path (-k) not specified. Valid system image paths are:
system-images;android-23;default;armeabi-v7a
system-images;android-23;google_apis;x86
system-images;android-23;default;x86_64
system-images;android-23;google_apis;x86_64
system-images;android-23;default;x86
system-images;android-23;google_apis;armeabi-v7a
Method 3: Using command lines instead of Android Emulator Plugin
[Screenshot of the third method][3]
I have then decided to drop the Android emulator plugin and start using a regular Windows batch command from jenkins with the following lines :
D:
cd D:\Tools\Dev\sdk\tools\
D:\Tools\Dev\sdk\tools\emulator.exe @Nexus5X_6_8664
When i Run "adb devices" on separated command line I am able to view my emulator finally running; However the emulator's window is not displayed and it keeps displaying the following error :
D:\Tools\Dev\sdk\tools>D:\Tools\Dev\sdk\tools\emulator.exe @Nexus5X_6_8664
Hax is enabled
Hax ram_size 0x60000000
HAX is working and emulator runs in fast virt mode.
init: Could not find wglGetExtensionsStringARB!
OpenGL backend 'angle' without OpenGL ES 1.x library detected. Using GLESv2 only.
eglMakeCurrent failed
eglMakeCurrent failed
eglMakeCurrent failed
eglMakeCurrent failed
Please note if i run D:\Tools\Dev\sdk\tools\emulator.exe @Nexus5X_6_8664
from my command line manually I'm not having any problem as the errors above.
More details :
- Jenkins services are running with my Login/Password access rights as an administrator. (I have followed cloudbees tutorial and it works fine)
- I have added window.x = 0 window.y = 0 to @Nexus5X_6_8664.ini