有没有办法在 Travis CI 构建中启动 android 模拟器? [英] Is there a way to start android emulator in Travis CI build?
问题描述
我有 python wrapper-library for adb,其中我有依赖于模拟器的单元测试或真实设备(因为它们执行 adb 命令).
I have python wrapper-library for adb where I have unit-test which depend on emulator or real device (since they execute adb commands).
我还想使用 Travis CI 作为构建环境,同时为每个构建执行这些单元测试.
I want also to use Travis CI as build environment along with executing those unit tests for each build.
有没有办法在 Travis CI 中以某种方式提供 android 模拟器,以便单元测试可以执行 adb 命令?
Is there a way to have android emulator available somewhow in Travis CI, so that unit tests can execute adb commands?
提前致谢!
推荐答案
根据 Travis CI 文档,您可以在 .travis.yml
中使用以下脚本启动模拟器:
According to the Travis CI documentation, you can start an emulator with the following script in your .travis.yml
:
# Emulator Management: Create, Start and Wait
before_script:
- echo no | android create avd --force -n test -t android-19 --abi armeabi-v7a
- emulator -avd test -no-skin -no-audio -no-window &
- android-wait-for-emulator
- adb shell input keyevent 82 &
在components
中指定你需要的系统镜像即可.
Just specify the system image you need in components
.
这篇关于有没有办法在 Travis CI 构建中启动 android 模拟器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!