Android Emulator in Jenkins

空扰寡人 提交于 2019-12-23 14:21:10

问题


I tried to use Android Emulator in Jenkins, I follow this guide: Jenkins Plugin

I do it from headless build machines, CentOS. I tried to create emulator from jenkins like the example

When I try to do this like the example, but with my version, I get this error from the jenkins:

PANIC: Broken AVD system path. Check your ANDROID_SDK_ROOT value [/opt/android-sdk_r24.2-linux]!
[android] Emulator did not appear to start; giving up
[android] Stopping Android emulator
$ /opt/android-sdk_r24.2-linux/platform-tools/adb kill-server
Finished: NOT_BUILT

I also try to do like the second example, I wrote " android list avd" in my terminal get :

Available Android Virtual Devices:
Name: android-23-emulator
Path: /root/.android/avd/android-23-emulator.avd
Target: Google APIs (Google Inc.)
     Based on Android 4.2.2 (API level 17)
Tag/ABI: default/armeabi-v7a

put the name "android-23-emulator" in the AVD name. And jenkins don't search this in the right folder, got this error:

FATAL: /var/lib/jenkins/.android/avd/android-23-emulator.ini (No such file or directory)
java.io.FileNotFoundException: /var/lib/jenkins/.android/avd/android-23-emulator.ini (No such file or directory)

When my:

ANDROID_AVD_HOME=/root/.android/avd
ANDROID_HOME=/opt/android-sdk_r24.2-linux
ANDROID_SDK_ROOT=/opt/android-sdk_r24.2-linux

I will be happy for any help! thanks!



回答1:


in order to run the Android emulator on headless Linux, you need to add the following switches (see my script, as an example how to always supply switches per default, when running the emulator):

-no-audio -no-window

in general, user jenkins cannot access /root ...

therefore you need to move over the $HOME/.android directory:

mv /root/.android /var/lib/jenkins/.android

and also the AVD location needs to be adjusted accordingly:

export ANDROID_AVD_HOME=/var/lib/jenkins/.android/avd


来源:https://stackoverflow.com/questions/44900957/android-emulator-in-jenkins

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!