# Android sdk license issue

**URL:** <https://discuss.bitrise.io/t/android-sdk-license-issue/97>\
**Category:** Builds\
**Created:** [January 4, 2017, 11:32am UTC](https://discuss.bitrise.io/t/android-sdk-license-issue/97 "2017-01-04T11:32:26Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![anatolii.kokuliuk](https://avatars.discourse-cdn.com/v4/letter/a/b2d939/32.png) [@anatolii.kokuliuk](https://discuss.bitrise.io/u/anatolii.kokuliuk)\
**Post date:** [January 4, 2017, 11:32am UTC](https://discuss.bitrise.io/t/android-sdk-license-issue/97/1 "2017-01-04T11:32:26Z")

</div>

Hi guys, i’ve faced this issue with build  
What went wrong:

> A problem occurred configuring project ‘:app’.

> > You have not accepted the license agreements of the following SDK components:

> [Solver for ConstraintLayout 1.0.0-beta4, ConstraintLayout for Android 1.0.0-beta4].

> 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 [Exporting licenses - Android Studio Project Site](http://d.android.com/r/studio-ui/export-licenses.html)

> - Try:

> Run with --info or --debug option to get more log output.

I think it’s issue on virtual machines

---

<div class="post-metadata">

**Author:** ![viktorbenei](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/viktorbenei/32/18_2.png) [@viktorbenei](https://discuss.bitrise.io/u/viktorbenei)\
**Post date:** [January 4, 2017, 2:56pm UTC](https://discuss.bitrise.io/t/android-sdk-license-issue/97/2 "2017-01-04T14:56:31Z")

</div>

Hi,

Thanks for asking this question here!

The official solution: You can find more info at the link printed in the log ([http://d.android.com/r/studio-ui/export-licenses.html](http://d.android.com/r/studio-ui/export-licenses.html)), but in short this can be done by:

**Locate the licenses on your Mac/PC** :

> If you have accepted the license agreements on one workstation, but wish to build your projects on a different one,  
> you can export your licenses by copying the accepted licenses folder from the Android Sdk Home  
> folder (this should be located at `<android sdk home path>/licenses`) of your current workstation,  
> to the Android Sdk Home directory of the machine where you now want to build your projects.

1. Create an `android-licenses` directory **in the root directory of your git repository** , and copy the license files into this directory from your Mac/PC.
2. Then in your Workflow on [bitrise.io](https://www.bitrise.io) copy the licenses to the right location using a `Script` step.

**Add the `Script` step right after the `Git Clone` step** (that’s when your code is available on the build virtual machine), with the content:

```auto
#!/bin/bash
# fail if any commands fails
set -e
# debug log
set -x

mkdir -p "$ANDROID_HOME/licenses"
rsync -avhP ./android-licenses/ "$ANDROID_HOME/licenses/"

```

That’s all, this script copies the licenses from the `android-licenses` (from your repository) into the system’s Android SDK Home path under `licenses` directory.

You can find more information and alternative solutions here: [http://devcenter.bitrise.io/android/frequent-android-issues/#could-not-find-an-android-package-or-you-have-not-accepted-the-license-agreements](http://devcenter.bitrise.io/android/frequent-android-issues/#could-not-find-an-android-package-or-you-have-not-accepted-the-license-agreements) , but the solution above is the current official solution (the “learn how to transfer the license agreements from one workstation to another” message in the log is not a Bitrise error/log, it comes from gradle and the Android tools).

---

<div class="post-metadata">

**Author:** ![viktorbenei](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/viktorbenei/32/18_2.png) [@viktorbenei](https://discuss.bitrise.io/u/viktorbenei)\
**Post date:** [March 6, 2017, 12:05pm UTC](https://discuss.bitrise.io/t/android-sdk-license-issue/97/3 "2017-03-06T12:05:54Z")

</div>

Alternatively, if you don’t want to store the licenses in your repository (although that’s probably the best solution), you can also:

- Using a ZIP file (_Don’t use this method unless necessary, it’s way more complicated to get right than it seems!)_:
  1. ZIP the licenses and upload to [Bitrise.io](http://Bitrise.io) (using the [Generic File Storage feature](http://devcenter.bitrise.io/tutorials/how-to-use-the-generic-file-storage/))
  2. then using the **ZIP resource archive downloader** step you can download and uncompress it into `$ANDROID_HOME/` (specify this as the **Extract path** option of the step) - _Note: **the path** (`$ANDROID_HOME`) **depends on which program you used to create the ZIP!** If you use Mac OS built in Finder -\> Compress tool the generated ZIP will include the “licenses” directory in the ZIP, so you shouldn’t include it in the path when you extract it. If you use another tool you might have to include `licenses` in the path (`$ANDROID_HOME/licenses`), depending on whether your ZIP itself includes it or not._

- Use a **Script** step and just `echo` into the files.

The license files are simple text/hash files, with a content like `8933bad161af4178b1185d1a37fbf41ea5269c55`, so you can also do something like this with a **Script** step:

```auto
#!/bin/bash
set -ex
echo '8933bad161af4178b1185d1a37fbf41ea5269c55' > $ANDROID_HOME/licenses/android-sdk-license
echo 'd975f751698a77b662f1254ddbeed3901e976f5a' > $ANDROID_HOME/licenses/intel-android-extra-license

```

Of course, **you will have to replace the license hashes when the license changes**.

---

<div class="post-metadata">

**Author:** ![DeveloperExozet](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/developerexozet/32/348_2.png) [@DeveloperExozet](https://discuss.bitrise.io/u/DeveloperExozet)\
**Post date:** [March 14, 2017, 5:01pm UTC](https://discuss.bitrise.io/t/android-sdk-license-issue/97/4 "2017-03-14T17:01:07Z")

</div>

I tried the last solution and it worked for me only if I would add all these line especially mkdir:

```
            set -ex
            mkdir -p "${ANDROID_HOME}/licenses"
            echo -e "\n8933bad161af4178b1185d1a37fbf41ea5269c55" > "${ANDROID_HOME}/licenses/android-sdk-license"
            echo -e "\n84831b9409646a918e30573bab4c9c91346d8abd" > "${ANDROID_HOME}/licenses/android-sdk-preview-license"
            echo -e "\nd975f751698a77b662f1254ddbeed3901e976f5a" > "${ANDROID_HOME}/licenses/intel-android-extra-license"

```

I am posting it just in case it will help someone  
(this solution is needed for constraint layout library otherwise it complains about licenses)

---

<div class="post-metadata">

**Author:** ![viktorbenei](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/viktorbenei/32/18_2.png) [@viktorbenei](https://discuss.bitrise.io/u/viktorbenei)\
**Post date:** [March 14, 2017, 5:27pm UTC](https://discuss.bitrise.io/t/android-sdk-license-issue/97/5 "2017-03-14T17:27:07Z")

</div>

You’re absolutely right @DeveloperExozet - thanks for sharing, I’ll update the licenses script ASAP!

Just one note - we just accepted a Pull Request which will include the `8933bad161af4178b1185d1a37fbf41ea5269c55` license by default in the default docker image, as well as a couple of preinstalled constrant-layout packages (after this weekend’s updates) - [https://github.com/bitrise-docker/android/pull/68](https://github.com/bitrise-docker/android/pull/68) - that should help in most cases.

---

<div class="post-metadata">

**Author:** ![viktorbenei](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/viktorbenei/32/18_2.png) [@viktorbenei](https://discuss.bitrise.io/u/viktorbenei)\
**Post date:** [September 1, 2017, 10:26am UTC](https://discuss.bitrise.io/t/android-sdk-license-issue/97/6 "2017-09-01T10:26:54Z")

</div>

Just a note: our current recommendation is to use the **Install missing Android tools** step, which should take care of these missing tools which require a license to be accepted: [Android - automatic dependency installer (e.g. build-tools) step : Install missing Android tools](http://discuss.bitrise.io/t/android-automatic-dependency-installer-e-g-build-tools-step-install-missing-android-tools/316)

---

<div class="post-metadata">

**Author:** ![ifnull](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/ifnull/32/3167_2.png) [@ifnull](https://discuss.bitrise.io/u/ifnull)\
**Post date:** [October 9, 2018, 8:05pm UTC](https://discuss.bitrise.io/t/android-sdk-license-issue/97/7 "2018-10-09T20:05:59Z")

</div>

This did not work for me. The checksum value for android-sdk-license was not 8933ba… but rather d56f5187…

I had to do the following…

```
# Create Android SDK license acceptance files
mkdir -p "${ANDROID_HOME}/licenses"
echo -e "\nd56f5187479451eabf01fb78af6dfcb131a6481e" > "${ANDROID_HOME}/licenses/android-sdk-license"
echo -e "\n84831b9409646a918e30573bab4c9c91346d8abd" > "${ANDROID_HOME}/licenses/android-sdk-preview-license"
echo -e "\nd975f751698a77b662f1254ddbeed3901e976f5a" > "${ANDROID_HOME}/licenses/intel-android-extra-license"
```

---

<div class="post-metadata">

**Author:** ![bitce](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/bitce/32/1639_2.png) [@bitce](https://discuss.bitrise.io/u/bitce)\
**Post date:** [October 11, 2018, 10:50am UTC](https://discuss.bitrise.io/t/android-sdk-license-issue/97/8 "2018-10-11T10:50:33Z")

</div>

Thanks for sharing @danielsmith_deutsch!
