# Build Fails on Acceptance of License Agreements

**URL:** <https://discuss.circleci.com/t/build-fails-on-acceptance-of-license-agreements/27828>\
**Category:** Bug Reports\
**Created:** [January 21, 2019, 3:04pm UTC](https://discuss.circleci.com/t/build-fails-on-acceptance-of-license-agreements/27828 "2019-01-21T15:04:35Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![gregk8288](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/gregk8288/32/12555_2.png) [@gregk8288](https://discuss.circleci.com/u/gregk8288)\
**Post date:** [January 21, 2019, 3:04pm UTC](https://discuss.circleci.com/t/build-fails-on-acceptance-of-license-agreements/27828/1 "2019-01-21T15:04:35Z")

</div>

Today new builds seem to be failing on acceptance of License Agreements.

```auto
Warning: License for package Android SDK Build-Tools 26.0.3 not accepted.
Checking the license for package Android SDK Platform 26 in /opt/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 project ':app'.
> You have not accepted the license agreements of the following SDK components:
  [Android SDK Build-Tools 26.0.3, 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

```

Can anyone shed some light on this.

Thanks

---

<div class="post-metadata">

**Author:** ![jasenmoloy](https://avatars.discourse-cdn.com/v4/letter/j/59ef9b/32.png) [@jasenmoloy](https://discuss.circleci.com/u/jasenmoloy)\
**Post date:** [January 22, 2019, 10:15pm UTC](https://discuss.circleci.com/t/build-fails-on-acceptance-of-license-agreements/27828/2 "2019-01-22T22:15:30Z")

</div>

Having the same issue. This is using the api-27-alpha docker image for reference.

According to the URL the message provides, it appears that we need to add a license folder to where the Android SDK manager lives on the build machine in order to allow the SDK manager to download the appropriate libraries.

Ref: [https://developer.android.com/studio/intro/update#download-with-gradle](https://developer.android.com/studio/intro/update#download-with-gradle)

Perhaps this is missing from the docker image?

---

<div class="post-metadata">

**Author:** ![rkistner](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/rkistner/32/16663_2.png) [@rkistner](https://discuss.circleci.com/u/rkistner)\
**Post date:** [January 24, 2019, 8:31am UTC](https://discuss.circleci.com/t/build-fails-on-acceptance-of-license-agreements/27828/3 "2019-01-24T08:31:41Z")

</div>

The licenses for the SDK components recently got updated, and the old `yes | sdkmanager --licenses` workaround doesn’t pick up the new licenses.

Adding this to my CircleCI config (before installing the SDK components) solved it for me - just check that the path matches your android-sdk path:

```yaml
      - run:
          name: Copy SDK License
          command: printf "8933bad161af4178b1185d1a37fbf41ea5269c55\nd56f5187479451eabf01fb78af6dfcb131a6481e\n24333f8a63b6825ea9c5514f83c2829b004d1fee\n" > ~/android-sdk-linux/licenses/android-sdk-license

```

You can get those license ids by:

1. Start with a fresh android-sdk install (or do an SSH rebuild on CircleCI).
2. Install the relevant sdk components, e.g. with `sdkmanager "build-tools;26.0.3"`, and manually accept the license.
3. Check the contents of `$ANDROID_HOME/licenses/android-sdk-license`.

---

<div class="post-metadata">

**Author:** ![krazik](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/krazik/32/17936_2.png) [@krazik](https://discuss.circleci.com/u/krazik)\
**Post date:** [January 25, 2019, 3:14pm UTC](https://discuss.circleci.com/t/build-fails-on-acceptance-of-license-agreements/27828/4 "2019-01-25T15:14:18Z")

</div>

I also had this problem I fixed by getting the licenses from my local development machine in `$HOME/Library/Android/sdk/licenses` on OSX. I added them to git and copy them in my build for now.

config.yml

```auto
      - run:
          name: Install licenses
          command: cp licenses/* /opt/android/sdk/licenses/

```

---

<div class="post-metadata">

**Author:** ![KyleTryon](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/kyletryon/32/9977_2.png) [@KyleTryon](https://discuss.circleci.com/u/KyleTryon)\
**Post date:** [January 25, 2019, 4:09pm UTC](https://discuss.circleci.com/t/build-fails-on-acceptance-of-license-agreements/27828/5 "2019-01-25T16:09:51Z")

</div>

Hello,

Please remove the `-alpha` tags from your images.

> <https://github.com/circleci/circleci-images/issues/323#issuecomment-456840051>

You may need to update your image to one of the currently available tags here: [https://hub.docker.com/r/circleci/android/tags](https://hub.docker.com/r/circleci/android/tags)

---

<div class="post-metadata">

**Author:** ![jasenmoloy](https://avatars.discourse-cdn.com/v4/letter/j/59ef9b/32.png) [@jasenmoloy](https://discuss.circleci.com/u/jasenmoloy)\
**Post date:** [January 25, 2019, 8:38pm UTC](https://discuss.circleci.com/t/build-fails-on-acceptance-of-license-agreements/27828/6 "2019-01-25T20:38:52Z")

</div>

Thanks @KyleTryon. I didn’t realize we have non alpha versions available. Is alpha meant to be a “canary” build or they legacy when moving over to docker images?

Also for future reference, I added a new step & command to my circle.yml file which approves all Android SDK licenses:

```
yes | $ANDROID_HOME/tools/bin/sdkmanager --licenses || if [$? -ne '141']; then exit $?; fi; #Captures SIGPIPE 141 error but still allow repeating "y" to accept all licenses

```

Since CircleCi captures pipe errors, that if statements captures the 141 error that occurs. All other errors are reported. error 141 occurs when sending input to a command that no longer exists.

This works on the same docker image as before. No additional changes were necessary.

---

<div class="post-metadata">

**Author:** ![tomgs](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/tomgs/32/21458_2.png) [@tomgs](https://discuss.circleci.com/u/tomgs)\
**Post date:** [February 19, 2019, 12:06pm UTC](https://discuss.circleci.com/t/build-fails-on-acceptance-of-license-agreements/27828/7 "2019-02-19T12:06:56Z")

</div>

@jasenmoloy This is really clever.  
I figured that it’s a false fail, since it clearly states that:

`All SDK package licenses accepted.`

And then exits with the non-0 141 code.

Thanks for this, my first green build on CircleCI is because of you!

Cheers,

Tom

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/circleci/original/3X/5/1/511608acda8e85906e15909b57bd0a46c1dbe291.png) [@system](https://discuss.circleci.com/u/system)\
**Post date:** [March 1, 2019, 12:06pm UTC](https://discuss.circleci.com/t/build-fails-on-acceptance-of-license-agreements/27828/8 "2019-03-01T12:06:56Z")

</div>

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.
