Skip to main content
All CollectionsKnowledge BaseAndroid
Could not find an Android package/license agreements not accepted
Could not find an Android package/license agreements not accepted
Updated over a week ago

Issue:

Could not find an Android package or you have not accepted the license agreements.

> A problem occurred configuring project ':lib'. 
   > You have not accepted the license agreements of the following SDK components:
   [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

or

Could not find com.android.support:appcompat-v7:24.2.0.

Possible solutions:

In general, we recommend you use the Install missing Android SDK components Step.

The above error means that your build requires an Android package which is either not (yet) preinstalled. You can see which packages are preinstalled on GitHub or which are the outdated ones.

The solution is to install/update the related package(s). To do that, add a Script Step to your Workflow. The Script Step should be added before the Step where you get the error or it can be the very first Step in the Workflow - with the following content:

#!/bin/bash
# fail if any commands fails
set -e
# debug log
 set -x # For newer Android SDK:
sdkmanager "extras;android;m2repository" 
sdkmanager "extras;google;m2repository" 
# For older Android SDK: 
echo y | android update sdk --no-ui --all --filter extra-android-m2repository | grep 'package installed'
echo y | android update sdk --no-ui --all --filter extra-google-m2repository | grep 'package installed'

In most cases you don’t need both packages to be updated, so you can try to remove them one by one, but having all three in the script covers most of the cases related to this error.

If the error is related to an outdated package, the workaround we describe here can be removed from your build after the weekend update is completed.

Alternative solution: Locating 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:

  1. Copy 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.

  2. Create an android-licenses directory in the root directory of your git repository, and copy the license files into this directory, then in your Workflow copy the licenses to the right location using a Script Step.

  3. 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:

#!/bin/bash
# fail if any commands fails
set -e 
# debug log 
set -x 
rsync -avhP ./android-licenses/ "$ANDROID_HOME/licenses/"
Did this answer your question?