Is Android 28 emulator supported?

My .travis.yml:

language: android
sudo: true
git:
  depth: 3
android:
  components:
    - tools
    - tools
    - platform-tools
    - build-tools-28.0.3
    # The SDK version used to compile your project
    - android-28
    # Additional components
    - extra-google-google_play_services
    - extra-google-m2repository
    - extra-android-m2repository

    # Specify at least one system image,
    # if you need to run emulator(s) during your tests
    - sys-img-x86-android-28
install:
  - echo y | sdkmanager "ndk-bundle"
  - echo y | sdkmanager "platforms;android-28"

before_script:
  - wget https://s3.amazonaws.com/download.onnx/models/opset_9/squeezenet.tar.gz && tar xf squeezenet.tar.gz
  - export ANDROID_NDK_HOME=$ANDROID_HOME/ndk-bundle
  - android list targets
  - echo no | android create avd --force -n test -t android-28 --abi x86
  - emulator -avd test -no-skin -no-audio -no-window &
  - android-wait-for-emulator
  - adb shell input keyevent 82 &

I got the error:

emulator: WARNING: the -no-skin flag is obsolete. to have a non-skinned virtual device, create one through the AVD manager

emulator: ERROR: This AVD's configuration is missing a kernel file! Please ensure the file "kernel-qemu" is in the same location as your system image.

emulator: ERROR: ANDROID_SDK_ROOT is undefined

but the output of android list targets seems correct

$ android list targets
Available Android targets:
----------
id: 1 or "android-25"
     Name: Android 7.1.1
     Type: Platform
     API level: 25
     Revision: 3
     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
 Tag/ABIs : no ABIs.
----------
id: 2 or "android-28"
     Name: Android 9
     Type: Platform
     API level: 28
     Revision: 6
     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
 Tag/ABIs : default/x86

If I change 28 to 26, it works correctly.

So is android 28 emulator not supported by travis ci?

2 Likes

So, can you run emulator with x86 abi on API 26 without the next error “Please ensure KVM is properly installed and usable”?

Hmm… yes

I tried to run android emulator with x86 on Travis but got error : “Please ensure KVM is properly installed and usable”. I find the issue with this problem, I understand that not possible run x86 build on Travis Add KVM support
It strange that it works in your case… Can you share more details? Maybe you can run tests on emulator or something?

Android emulators not starting for the last few days? (late March 2019) - the canary emulator will run x86_64 without accel now but API28 is failing due to some ADB issue (a timeout I think). APIQ isn’t starting yet, but everything from API16 to API27 except API19 works in that link

I tried propably every possible combination to get newer Android SDK and Emulator to run on travis.
No luck.

  • Tried to use android container, but manually switching to use the new sdkmanager (didn’t work)
  • Tried different system images
  • Tried to use java container, downlad new android SDK manually
  • Tried different emulator settings / images

Nothing worked, I’m giving up. So no, the x86 emulators just wont run on Travis.

Right now, I’m switching to running the tests on Firebase Test Lab - as described here:

But, the x86 emulators do work. I have a working example.
I just don’t have the newest APIs (API28+) working, because ddmlib times out while loading APKs.
But I’ve seen a thread somewhere that indicates you can snag the ddmlib source code (which I’ve done) and you can hack it a bit (which I have not done) to extend the timeouts.
At which point even the newer APIs should work.
You can see here: proof, with open source goodness so you can share and enjoy https://travis-ci.org/ankidroid/Anki-Android/builds/516486599

That’s cool. Can we see your .travis.yml, please?

follow the links there it’s all open source work. the current Anki-Android .travis.yml even has matrices done correctly so we can start testing modern JDKs with acceptable failures so they don’t fail the whole build

Got it! THanks. x86 is down there in the matrix. I just saw the

  global:
    - ADB_INSTALL_TIMEOUT=8
    - ABI=armeabi-v7a

No joy:

Could not launch '/home/travis/build/couchbase/couchbase-lite-android-ce/../emulator/qemu/linux-x86_64/qemu-system-x86_64': No such file or directory

Fixed that by calling the emulator directly (use the one in $ANDROID_HOME/emulator, not the one in tools/, as your config suggests). Now the same old, same old KVM error:

emulator: ERROR: x86_64 emulation currently requires hardware acceleration!

Such a pain.

My configuration is live and working, just take the one from ankidroid master and go from there, no pain required?

1 Like

Thank you @mikehardy for your example.
It helped me to update the build of my app https://travis-ci.org/andstatus/todoagenda

To all: Trying to use Mike’s config please note that some scripts are located in his app’s repository. E.g. “./tools/android-wait-for-emulator.sh” is in the “tools” folder of the repository ( https://github.com/ankidroid/Anki-Android/tree/master/tools ) although it looks like Android system’s or Travis’s own tool :-).
I spent some time figuring this out…

Thanks @yvolk, I used your config to setup Android Detox e2e tests for React Native project on Travis.
Here’s the PR https://github.com/BlueWallet/BlueWallet/pull/891