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:

before_install:
- 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
android:
  components:
    - 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
licenses:
  - 'android-sdk-preview-license-.+'
  - 'android-sdk-license-.+'
  - 'google-gdk-license-.+'
 
before_install:
#  - chmod +x gradlew
  - yes | sdkmanager "platforms;android-30"
    
before_script:
  - 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 &
  
before_cache:
  - rm -f  $HOME/.gradle/caches/modules-2/modules-2.lock
  - rm -fr $HOME/.gradle/caches/*/plugin-resolution/

cache:
  directories:
  - $HOME/.gradle/caches/
  - $HOME/.gradle/wrapper/
  - $HOME/.android/build-cache
    
script:
  - 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

env: 
  - CODECOV_TOKEN=a-code-is-here


after_success:
  - bash <(curl -s https://codecov.io/bash)

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
Imprint