Trying to get Android build with SDK bigger than 22

I’m struggling to get try and get Travis to build an android project with an emulator that is a higher SDK level than 22?

You need to add the following line to your .travis.yml configuration file:

- yes | sdkmanager "platforms;android-30"

It would also be helpful in the future to see your .travis.yml. If there’s sensitive information in it, just supply the areas that are giving you concern.

Thanks for getting back to me @Montana

Here is my current .travis.yml

sudo: required

language: android
dist: trusty
    - tools
    - build-tools-30.0.2
    - android-30
    - android-22
    - extra-google-google_play_services
    - extra-google-m2repository
    - extra-android-m2repository
    - sys-img-armeabi-v7a-android-22
  - 'android-sdk-preview-license-.+'
  - 'android-sdk-license-.+'
  - 'google-gdk-license-.+'
#  - chmod +x gradlew
  - yes | sdkmanager "platforms;android-30"
  - echo no | android create avd --force -n test -t android-22 --abi armeabi-v7a
  - emulator -avd test -no-audio -no-window &
  #- adb shell settings put global window_animation_scale 0 &
  #- adb shell settings put global transition_animation_scale 0 &
  #- adb shell settings put global animator_duration_scale 0 &
  - android-wait-for-emulator
  - adb shell input keyevent 82 &
  - rm -f  $HOME/.gradle/caches/modules-2/modules-2.lock
  - rm -fr $HOME/.gradle/caches/*/plugin-resolution/

  - $HOME/.gradle/caches/
  - $HOME/.gradle/wrapper/
  - $HOME/.android/build-cache
  - cd WifiMapper
  - adb shell appops set com.riba2reality.exeterlocate 58 allow
  - ./gradlew clean test build
# - ./gradlew jacocoTestReport
# - ./gradlew createDebugCoverageReport
# - ./gradlew connectedCheck #instrucment tests
  - ./gradlew jacocoTestReport

  - CODECOV_TOKEN=a-code-is-here

  - bash <(curl -s

This project is now Open-Source, so feel free to take a look GitHub - MJGibson/Exeter_Locate: Exeter locate application and associated server setup

I’ve recently been adding a few tests. At this time of posting, i was trying to set up mock locations in the android emulator, but that is only available from SDK 25+
As you can see I am using the Android-30 platform as you and other guides advise, but using the suggested travis setup for the emulator appears to be using android-22.

Furthermore, as I’ve been adding some other test recently my builds appear to either have become intermittent in their successes (on the same builds, sometimes working, sometimes not), to the point where I can’t seem to get them to work. Mainly seems to be stemming from the use of the old emulator… I think.
maybe there is some time out I’ve missed?

Hello Dr. Gibson,

Let me take a look at this for you and see if I can’t get a working build for you by tweaking some of the specs in the travis.yml file!

1 Like