Accept Android build tools licenses

Andres Sandoval
1 min readAug 6, 2023

When using the latest Gradle(alpha) versions we get the build error “Failed License not accepted for build tools”. The solution is to add command to accept the license. Below are code snippets to fix Github actions and Dockerfile.


Checking the license for package Android SDK Build-Tools 34-rc3 in /usr/local/lib/android/sdk/licenses

Warning: License for package Android SDK Build-Tools 34-rc3 not accepted.
FAILURE: Build failed with an exception.

How to fix error on Github Actions:

- name: List Android Packages
run: sudo $ANDROID_HOME/tools/bin/sdkmanager --list | sed -n '/Available Packages/q;p'
- name: Accept license 34.0.0-rc3
run: echo "y" | sudo $ANDROID_HOME/tools/bin/sdkmanager "build-tools;34.0.0-rc3"

How to fix error on Dockerfile:

RUN echo yes | ${ANDROID_HOME}/cmdline-tools/tools/bin/sdkmanager "build-tools;34.0.0" && \
echo yes | ${ANDROID_HOME}/cmdline-tools/tools/bin/sdkmanager "platforms;android-33"

Solution to solve this error:


Thanks for spending your time reading it and let me know if I’m wrong somewhere or if there’s something that could do differently or better. I’m open to your feedback 🙌🏻


Related article: