微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

在Travis CI中启动Android x86仿真器时出错

当我跑
android connectedCheck

在Travis中使用ARM模拟器,构建通常以超时错误结束.所以我试图用x86模拟器来运行我的构建和测试.但是当我运行命令时:

emulator -avd test -no-skin -no-audio -no-window &

我得到这个错误

emulator: ERROR: x86 emulation currently requires hardware acceleration!
Please ensure KVM is properly installed and usable.
cpu acceleration status: KVM is not installed on this machine (/dev/kvm is missing).

我在Travis CI文档中注意到似乎支持x86仿真器,所以我很想知道这是可能的.但是我没有找到任何使硬件加速正常工作的参考.我也试过运行这个命令:

sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils

在创建模拟器之前,我仍然收到相同的错误.

这是我的.travis.yml脚本:

language: android
jdk: oraclejdk7

env:
  global:
    - ANDROID_BUILD_API_LEVEL=22
    - ANDROID_BUILD_TOOLS_VERSION=22.0.1
    - ANDROID_ABI=default/x86
    - ANDROID_EMULATOR_API_LEVEL=19

android:
  components:
    #- platform-tools
    #- tools
    - build-tools-$ANDROID_BUILD_TOOLS_VERSION
    - android-$ANDROID_BUILD_API_LEVEL
    - android-$ANDROID_EMULATOR_API_LEVEL

    - addon-google_apis_x86-google-$ANDROID_EMULATOR_API_LEVEL

    - extra-google-google_play_services
    - extra-android-support
    - extra-google-m2repository
    - extra-android-m2repository

    - sys-img-x86-android-$ANDROID_EMULATOR_API_LEVEL

notifications:
  email: true

before_script:
  - sudo apt-get update -qq
  - sudo apt-get install -qq libstdc++6:i386 lib32z1 expect
  # for gradle output style
  - export TERM=dumb

  # environment info
  - ./gradlew -v
  - uname -a

  # emulator
  - echo no | android create avd --force -n test -t "Google Inc.:Google Apis (x86 System Image):"$ANDROID_EMULATOR_API_LEVEL --abi $ANDROID_ABI
  - emulator -avd test -no-skin -no-audio -no-window &
  - android-wait-for-emulator
  - adb shell input keyevent 82 &

# build
script:
  - ./gradlew clean connectedCheck -PdisablePreDex

有人有这个工作吗?

解决方法

英特尔仿真器无法在Travis上运行.由于Travis运行虚拟机,因此虚拟机在其他虚拟机中的硬件加速是一件困难的事情.

您现在必须运行ARM仿真器.

他们可能在不久的将来做到这一点.订阅此问题以通知.
https://github.com/travis-ci/travis-ci/issues/1419

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐