Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Travis-CI Android SDK license problems

I'm trying to build my Android project with Travis and currently I'm getting error:

A problem occurred configuring project ':app'.
> You have not accepted the license agreements of the following SDK 
components:
[Android SDK Build-Tools 27.0.1].

I don't know how, but yesterday I could solve problem with that:

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

But now it doesn't help me. I will be grateful for any advice.

Here is build URL https://travis-ci.org/madsunrise/luna-mobile/jobs/325034903 and also I put travis.yml below

sudo: required

language: android
jdk: oraclejdk8

notifications:
  email:
    recipients:
      - [email protected]
    on_success: change
    on_failure: always

before_cache:
  - rm -f  $HOME/.gradle/caches/modules-2/modules-2.lock
  - rm -rf $HOME/.gradle/caches/*/plugin-resolution/

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

cache:
  directories:
  - $HOME/.gradle/caches/
  - $HOME/.gradle/wrapper/
  - $HOME/.android/build-cache

env:
 global:
 - ANDROID_API=27
 - ANDROID_BUILD_TOOLS=27.0.2

android:
 components:
  - tools
  - tools # Running this twice get's the latest build tools
  - platform-tools
  - android-${ANDROID_API}
  - build-tools-${ANDROID_BUILD_TOOLS}
  - extra

script:
   - ./gradlew clean test build
like image 643
Ivan Rudnev Avatar asked Jan 04 '18 14:01

Ivan Rudnev


1 Answers

Replace

- ANDROID_BUILD_TOOLS=27.0.2

by

- ANDROID_BUILD_TOOLS=27.0.1

or add:

- echo yes | sdkmanager "build-tools;27.0.1"

to explicitly install the matching version and accept the license as commented here.

Explanation

Since Android Plugin for Gradle 3.0.0 (October 2017)

you no longer need to specify a version for the build tools—the plugin uses the minimum required version by default. So, you can now remove the android.buildToolsVersion property.

You are not specifying a version here, you are explicitly installing version 27.0.2, and Gradle is downloading version 27.0.1 without accepting the license agreement as explained here.

Alternatively add buildToolsVersion 27.0.2 to your app/build.gradle:

android {
    compileSdkVersion 27
    buildToolsVersion "27.0.2"

Note

Seems that it's possible to automatically accept all the licenses, and echo is no longer required:

- yes | sudo sdkmanager --licenses

But I didn't test it, please check this question for further information.

you might still need to copy the licence files to other locations based on your setup.

like image 92
albodelu Avatar answered Oct 31 '22 15:10

albodelu