gonczor
gonczor

Reputation: 4146

Travis for android licence issues

I am trying to implement CI for one of my projects and whenever travis runs it ends up with following error:

FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> You have not accepted the license agreements of the following SDK components:
  [Android SDK Build-Tools 25.0.1, Android SDK Platform 25].
  Before building your project, you need to accept the license agreements and complete the installation of the missing components using the Android Studio SDK Manager.
  Alternatively, to learn how to transfer the license agreements from one workstation to another, go to http://d.android.com/r/studio-ui/export-licenses.html
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED

I have gone through this question, this example and some others, but I can't figure out what I'm doing wrong.

language: android
jdk:
  - oraclejdk8
sudo: true
before_install:
- chmod +x gradlew
env:
  global:
   - ANDROID_API_LEVEL=23
   - EMULATOR_API_LEVEL=21
   - ANDROID_BUILD_TOOLS_VERSION=23.0.1
   - ANDROID_ABI=armeabi-v7a
   - ANDROID_TAG=google_apis
   - ADB_INSTALL_TIMEOUT=8 # minutes (2 minutes by default)
android:
  components:
    - tools
    - tools
    - platform-tools
    - build-tools-$ANDROID_BUILD_TOOLS_VERSION
    - android-$ANDROID_API_LEVEL
    - android-$EMULATOR_API_LEVEL
    - extra
    - add-on
    - extra-google-m2repository
    - extra-android-m2repository

    # Google Play Services
    - extra-google-google_play_services
    # Support library
    - extra-android-support

    - addon-google_apis-google-$ANDROID_API_LEVEL
    - addon-google_apis-google-$EMULATOR_API_LEVEL

    - sys-img-armeabi-v7a-google_apis-$ANDROID_API_LEVEL
    - sys-img-armeabi-v7a-google_apis-$EMULATOR_API_LEVEL

  licenses:
    - 'android-sdk-preview-license-.+'
    - 'android-sdk-license-.+'
    - 'intel-android-extra-license.+'

before_script:
    - echo no | android create avd --force -n test -t "android-23" --abi $ANDROID_ABI --tag $ANDROID_TAG
    - emulator -avd test -no-window &
    - android-wait-for-emulator
    - adb shell input keyevent 82 &

In case anyone needed more detailed info about the project please see the github page.

Upvotes: 2

Views: 357

Answers (1)

gonczor
gonczor

Reputation: 4146

OK, so a little bit more coffee to make my googling more efficient solved the issue. The problem was described here in detail. I had to add following lines to my code (still don't understand what do I need this 25 for, but at least it works):

- build-tools-25.0.1
- android-25

Upvotes: 2

Related Questions