Jenkins中的Android模拟器 [英] Android Emulator in Jenkins

查看:43
本文介绍了Jenkins中的Android模拟器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试在Jenkins中使用Android模拟器,
我遵循此指南: Jenkins插件

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

我是从无头构建机器CentOS上完成的。
我尝试从詹金斯(Jenkins)像示例创建模拟器

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

我也尝试像第二个例子一样,我在终端
get中写了 android list avd:

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

在AVD名称中输入名称 android-23-emulator。
并且jenkins不在正确的文件夹中搜索此错误:

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)

当我的时间:

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!

推荐答案

为了运行Android 模拟器在无头Linux上,您需要添加以下开关(请参阅我的脚本,例如,如何在运行模拟器时始终默认提供开关):

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

通常,用户 jenkins 无法访问 / root ...

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

因此,您需要移至 $ HOME / .android 目录:

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

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

,并且AVD位置也需要相应地进行调整:

and also the AVD location needs to be adjusted accordingly:

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

这篇关于Jenkins中的Android模拟器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆