Licences for Android build tools not accepted

android

#1

Seems like something’s not right with most recent build tools:

* 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 26.0.2].
  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

Although this only happened after updating google services plugin to 3.1.1 and before that several builds after changing build tools to 26.0.2 did work properly.

The docker image on docker hub shows that it’s been updated 6 hours ago. But Android’s image in circle’s repository hasn’t been changed for almost 3 weeks. Might this be because some other image changed? Either way things don’t work


Android SDK license
Failed to install the following Android SDK packages as some licences have not been accepted
Android: License not accepted
Licenses missing
#2

Hi there,

I think the problem stems from the fact that the build tools 29.0.2 are not installed.

The list that we install is here:

You will have to to manually accept the license for now. I believe that this will do it:

sdkmanager --update && yes | sdkmanager --licenses

I’ll work on adding 26.0.2 to the build image.

Thanks,

Marc


#3

Hi there,

I recently migrated my CircleCI builds from 1.0 to 2.0 and they worked well for a few days, but today I got the build failure about SDK license without any change to config.yml:

> You have not accepted the license agreements of the following SDK components:
  [Android SDK Build-Tools 26.0.2].
  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

I tried https://developer.android.com/studio/intro/update.html#download-with-gradle but still doesn’t work.

The docker image I have in my config.yml is circleci/android:api-26-alpha (https://hub.docker.com/r/circleci/android/tags/), and I found that it has been updated several hours before and it seems the build failure occurred after that update… :thinking:


#4

I’ve got the same problem for just about any android api version I put in. Mine is supposed to be api 19, but there doesn’t seem to be an image anywhere. Also using 2.0 build. EDIT: Mine was also working as of yesterday, but popped up with this same warning.


#5

I’ve started the process of adding those build tools here: https://github.com/circleci/circleci-images/pull/88


#6

Mark,

thanks for prompt response, although note that this might not be the solution. Gradle already installs necessary build tools if they’re not present, and builds with build tools 26.0.2 have worked already. Has anything changed in last couple of hours? As I’ve noted, and well as s-nagahori has, circleCI android api-26-alpha tag has been updated recently, and only after that the builds stopped working


#7

Hi lwasylkowski,

We have not changed anything on our end, but we do build a new image every night, so I guess we really make changes every night.

What I guess has happened is that Google might have updated something in SDK manager - maybe changed the text of the licenses? (The accepted licenses are stored as a SHA1 digest of the license text).

If you add sdkmanager --update && yes | sdkmanager --licenses as a build step does it help?

Marc


#8

Weird, adding that prints out licence agreement, and then

November 20, 2015
---------------------------------------
Accept? (y/N): All SDK package licenses accepted

Exited with code 141

The build step fails, and the whole build fails


#9

echo “Y” | /opt/android/sdk/tools/bin/sdkmanager “build-tools;26.0.2”

I added this step after my restore_cache step and before my gradlew dependencies step. This properly accepted and downloaded v26.0.2 build tools. Not a proper solution, but it works for now.


#10

Hm. That workaround didn’t work for me:

Warning: Failed to find package “build-tools
[===                                    ] 10% Computing updates...              
Exited with code 1

But this did:

   - run:
       name: Approve license for build tools
       command: (echo y; echo y; echo y; echo y; echo y; echo y) | $ANDROID_HOME/tools/bin/sdkmanager --licenses

hat tip this person:


#11

Tried all, only this one works, thank you!


#12

Hi everyone,

Sorry about the problems that you are having with this. It seems that Google have amended one of the Android SDK licenses today, and that exposed a bug in how I wrote the license accepting script in our Dockerfie. I’ve updated the CircleCI 2.0 image to accept the licenses properly - https://github.com/circleci/circleci-images/commit/1ac3ee07c1142291cafaf74c21b04fed46016a57 - this was the bug - the SDK manager would not update all components because the licenses had not yet been accepted.

For CircleCI 1.0 users, @edenman’s comment is the best solution - Licences for Android build tools not accepted.

Sorry for the downtime you have had today because of this.

Marc


#13

I am seeing a similar license issue but with [Android Support Repository]. My build error also just started happening today, and occurs even when I rebuild a previously passing build.

Another user posted this here, but I thought I’d see if these two issues were linked.

https://discuss.circleci.com/t/licenses-missing/17320


#14

Hi Alan,

Is this still failing for you? It might have taken a while for the new Docker image to propagate around through our Docker caches.

Marc


#15

I get this message

Checking the license for package Android SDK Platform 25 in /opt/android/sdk/licenses
License for package Android SDK Platform 25 accepted.
Preparing “Install Android SDK Platform 25 (revision: 3)”.
“Install Android SDK Platform 25 (revision: 3)” ready.
Finishing "Install Android SDK Platform 25 (revision: 3)“
Installing Android SDK Platform 25 in /opt/android/sdk/platforms/android-25
"Install Android SDK Platform 25 (revision: 3)” complete.
“Install Android SDK Platform 25 (revision: 3)” finished.
Checking the license for package Android Support Repository in /opt/android/sdk/licenses
Warning: License for package Android Support Repository not accepted.

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 Support 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

Current config.yml is:

version: 2
jobs:
  build:
    working_directory: ~/TabletopApp/TabletopRoleplayTool
    docker:
      # specify the version you desire here
      - image: circleci/android:api-23-alpha

    environment:
      JVM_OPTS: -Xmx3200m

    steps:
      - checkout:
          path: ~/TabletopApp

      # Download and cache dependencies
      - restore_cache:
          key: jars-{{ checksum "build.gradle" }}-{{ checksum  "app/build.gradle" 

}}

      - run:
          name: chmod permissions
          command: chmod +x ./gradlew

      - run:
          name: Approve license for build tools
          command: (echo y; echo y; echo y; echo y; echo y; echo y) | 

$ANDROID_HOME/tools/bin/sdkmanager --licenses

      - run: 
          name: Download Dependencies
          command: ./gradlew androidDependencies

      - save_cache:
          paths:
            - ~/.gradle
          key: jars-{{ checksum "build.gradle" }}-{{ checksum  "app/build.gradle" 

}}

      # run tests!
      - run: 
          name: Run Tests
          command: ./gradlew lint test

      - store_artifacts:
          path: app/build/reports
          destination: reports

      - store_test_results:
          path: app/build/test-results

fails at “Approve license for build tools”


#16

Fixed on CircleCI side it seems.


#17

Hi Marc,

It’s no longer failing for me! Appreciate the quick response.

Thanks,

Alan


#18

Hi Marc,
I have started having this issue while trying to run my ionic application using cordova run android from the command line. I have tried the license fix excepting it multiple times but I still receive the error. Here is what it looks like:

[23:33:02] lint finished in 1.99 s
Checking the license for package Android SDK Platform 26 in /usr/lib/android-sdk/licenses
Warning: License for package Android SDK Platform 26 not accepted.

FAILURE: Build failed with an exception.

  • What went wrong:
    A problem occurred configuring root project ‘android’.
    You have not accepted the license agreements of the following SDK components:
    [Android SDK Platform 26].
    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

#19

@gettindatfoshow
Had the same problem, managed to resolve it with this:

dependencies:
override:
- echo y | android update sdk --no-ui --all --filter build-tools-26.0.2,android-26

instead of my original:

dependencies:
override:
- echo y | android update sdk --no-ui --all --filter build-tools-26.0.2


#20

Exactly the same failure for me.
On CircleCI 2.0 and follow the tutorial https://circleci.com/docs/2.0/language-android/
@marc any suggestion?