Travis-CI `Android 28 licenses have not been accepted`

Viewed 3128

I'm trying to build android project using Travis using android-28 and build-tools-28.0.0 but no matter what I do I get

>Failed to install the following Android SDK packages as some licences have not been accepted.
     platforms;android-28 Android SDK Platform 28
     build-tools;28.0.0 Android SDK Build-Tools 28
  To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
  Alternatively, to transfer the license agreements from one workstation to another, see http://d.android.com/r/studio-ui/export-licenses.html

during compiling.

I've tried:

  • adding:
    components:
      - build-tools-28.0.0
      - android-28
    
  • installing through:
    echo y | android update sdk --no-ui --filter build-tools-28.0.0,android-28,extra-android-m2repository
    
  • accepting licenses using:
    yes | sudo $ANDROID_HOME/tools/bin/sdkmanager --licenses
    
  • accepting licenses using:
    licenses:
      - 'android-sdk-preview-license-52d11cd2'
      - 'android-sdk-license-.+'
      - 'google-gdk-license-.+'
    
  • even manually writing to file inside $ANDROID_SDK/licenses.

I'm pretty sure that 2 weeks ago it was working completely normal, but now it just throwing this error everytime.

PR in question so you can look at errors, builds and files.

1 Answers

Add code below to your .travis.yml file

before_install:
  - yes | sdkmanager "platforms;android-28"

or

before_install:
  - chmod +x gradlew
  - mkdir "$ANDROID_HOME/licenses" || true
  - echo -e "\n8933bad161af4178b1185d1a37fbf41ea5269c55" > "$ANDROID_HOME/licenses/android-sdk-license"
  - echo -e "\n84831b9409646a918e30573bab4c9c91346d8abd" > "$ANDROID_HOME/licenses/android-sdk-preview-license"
  - yes | sdkmanager --update
  - yes | sdkmanager --licenses
Related