Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error launching Android x86 Emulator in Travis CI

When I run

android connectedCheck

with an ARM emulator in Travis, the build usually ends on a Timeout error. So I instead am trying to run my build and tests with the x86 emulator. But when I run the command:

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

I get this error:

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).

I've noticed in the Travis CI docs that there does appear to be support for the x86 emulators, so I am asumming that it is possible. But I have been unable to find any reference to getting them to work properly with hardware acceleration. I have also tried running this command:

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

before creating the emulator but I still get the same error.

Here is my .travis.yml script:

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

Has anyone got this to work before?

like image 743
uncle_tex Avatar asked May 20 '15 16:05

uncle_tex


1 Answers

Intel emulators cannot be run on Travis yet. Since Travis runs virtual machines, hardware acceleration in virtual machine in an other virtual machine is a hard thing.

You have to run ARM emulators for now.

They may do it in a near future. Subscribe to this issue to be notified. https://github.com/travis-ci/travis-ci/issues/1419

like image 164
tasomaniac Avatar answered Oct 16 '22 07:10

tasomaniac