Home » Android » continuous integration – Travis Ci build error caused by Android SDK license agreements

continuous integration – Travis Ci build error caused by Android SDK license agreements

Posted by: admin June 15, 2020 Leave a comment

Questions:

I have experience with CircleCi:

https://circleci.com/gh/mmirhoseini/fyber_mobile_offers/28

but I cannot solve this license issue with the same repository on TravisCi:

https://travis-ci.org/mmirhoseini/fyber_mobile_offers/builds/167852390

This is travis error log:

FAILURE: Build failed with an exception.

What went wrong: A problem occurred configuring project ‘:fyber-app’.

You have not accepted the license agreements of the following SDK components: [SDK Patch Applier v1, Google Repository].

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

Travis Ci Screenshot

I know that it is a license issue but don’t know how to solve it. Here is my .travis.yml file:

language: android

sudo: required

android:
  components:
    - tools
    - platform-tools
    - build-tools-24.0.2
    - android-24
    - extra-android-m2repository
  licenses:
    - 'android-sdk-preview-license-.+'
    - 'android-sdk-license-.+'
    - 'intel-android-extra-license.+'

jdk:
  - oraclejdk8

before_install:
  - chmod +x gradlew

script:
  - ./gradlew build
How to&Answers:

It seems that you have the google repository missing.

Add the - extra-google-m2repository and try the build again.

Here is my .travis.yml for reference:

language: android
android:
  components:
    - tools
    - platform-tools
    - build-tools-24.0.3
    - android-24
    - extra-android-m2repository
    - extra-google-m2repository
    - extra-android-support
    - extra-google-google_play_services
jdk:
  - oraclejdk8
script:
  - ./gradlew test