Not able to create emulators with android api 24/25/26. Device shows only black screen. Tests getting failed. Can anyone please check if below commands are correct?


#1

machine:
environment:
ANDROID_HOME: /usr/local/android-sdk-linux
ruby:
version: 2.4.0

dependencies:
pre:
- ruby -v
- sudo gem install bundler -n /usr/local/bin
- nvm use v8.2.0 && nvm alias default v8.2.0
- echo y | android update sdk --no-ui --all --filter platform-tools
- echo y | android update sdk --no-ui --all --filter build-tools-25.0.2
- echo y | android update sdk --no-ui --all --filter android-25
- echo y | android update sdk --no-ui --all --filter extra-android-m2repository
- echo y | android update sdk --no-ui --all --filter extra-google-google_play_services
- echo y | android update sdk --no-ui --all --filter extra-google-m2repository
- echo y | android update sdk --no-ui --all --filter “sys-img-armeabi-v7a-google_apis-25”
- echo no | android create avd -n circleci-android25-googleapis -t ‘android-25’ --abi google_apis/armeabi-v7a
cache_directories:
- /opt/circleci/nodejs/v8.2.0/lib/node_modules/appium
# - /usr/local/android-sdk-linux/platforms/android-24
# - /usr/local/android-sdk-linux/build-tools/25.0.2
override:
- bundle check --path=vendor/bundle || bundle install --path=vendor/bundle --jobs=4 --retry=3

test:
pre:
- emulator -avd circleci-android25-googleapis -gpu off:
background: true
parallel: true
- sleep 30
- circle-android wait-for-boot
- abd devices


#2

I got the same issue as you

I tried to launch the emulator with XQuartz to see what is actually happening for the command

  • circle-android wait-for-boot
    to stay stuck until timed out.
    The emulator started but the window of the emulator (not the emulated phone) keeps blinking, showing 6 sec of white screen then the normal emulator screen with commands (emulator’s screen still black).

Here’s the commands used by circleci the starting of the emulator (sorry for the formating):

machine:
environment:
ANDROID_HOME: /usr/local/android-sdk-linux
QEMU_AUDIO_DRV: none

dependencies:
pre:
# Android SDK Build-tools, revision 26.0.0
- if [ ! -e /usr/local/android-sdk-linux/build-tools/26.0.0 ]; then echo y | android update sdk --all --no-ui --filter “build-tools-26.0.0”; fi;
# Android SDK Platform 26
- if [ ! -e /usr/local/android-sdk-linux/platforms/android-26 ]; then echo y | android update sdk --all --no-ui --filter “android-26”; fi;
# Android Support Libs
- if ! $(grep -q “Revision=47.0.0” /usr/local/android-sdk-linux/extras/android/m2repository/source.properties); then echo y | android update sdk --all --no-ui --filter “extra-android-m2repository”; fi;
# Android Tools
- echo y | android update sdk --no-ui --all --filter tools
# Android Plateform Tools
- echo y | android update sdk --no-ui --all --filter platform-tools
# Android Support
- echo y | android update sdk --no-ui --all --filter extra-android-support
# Android Google Play Services
- echo y | android update sdk --no-ui --all --filter extra-google-google_play_services
# Google Support Libs
- echo y | android update sdk --no-ui --all --filter extra-google-m2repository
# Android image with Google Play Services APIs
- echo y | android update sdk -a -u -t sys-img-armeabi-v7a-google_apis-25

# Create the android 25 AVD
 - echo no | android create avd -n circleci-android25-googleapis -t 'android-25' --abi google_apis/armeabi-v7a
 - sudo apt-get install -y x11vnc
 - x11vnc -forever -nopw:
     background: true

override:
- ANDROID_HOME=/usr/local/android-sdk-linux

cache_directories:
- /usr/local/android-sdk-linux/build-tools/26.0.0
- /usr/local/android-sdk-linux/platforms/android-26
- /usr/local/android-sdk-linux/extras/android/m2repository

test:
override:
- android list avd
- adb logcat:
background: true
parallel: true

And then from the ssh session :

emulator -avd circleci-android25-google-apis -gpu off

Help needed :cry:


#3