Skip to content
black android smartphone showing instagram and gmail application

Failed to install the following Android SDK packages as some licences have not been accepted

Gökhan Duman

Reason for the Error

The error message indicates that certain Android SDK packages cannot be installed because you haven’t accepted their licenses.

Solution

The solution to the “Failed to install the following Android SDK packages as some licenses have not been accepted” error can vary based on the operating system and platform you’re using.

You can resolve the error by accepting the licenses through command-line commands in the console or through Android Studio.

For macOS

yes | ~/Library/Android/sdk/tools/bin/sdkmanager --licenses

If the SDK Manager is installed in a different directory, you might need to change the directory.

If the problem persists, it could be related to your Java installation. Additionally, you might need to enter the provided code.

export JAVA_HOME=/Applications/Android\ Studio.app/Contents/jre/jdk/Contents/Home

For Flutter

If you’re using Flutter, you can easily resolve the license error using the “flutter-doctor” command as mentioned.

flutter doctor --android-licenses

For Linux

If you encounter the error on a Linux distribution (such as Ubuntu, Fedora, Debian, etc.), you can resolve it by accepting the licenses as described.

yes | ~/Android/Sdk/tools/bin/sdkmanager --licenses

Again, if the SDK Manager is installed in a different directory, you need to update the directory to match the SDK Manager’s installation directory.

For Windows

If Android SDK Manager is added to your environment variables on Windows, you can use the provided code to resolve the error. If you get a “command not found” error, make sure to provide the full directory path.

sdkmanager --licenses

If the ANDROID_HOME environment variable isn’t defined, you might need to navigate to the directory where sdkmanager is located and open the console there to accept the licenses.

%ANDROID_HOME%/tools/bin/sdkmanager --licenses

Assuming the directory where SDK Manager is installed on your Windows machine is C:/Android/tools/bin/sdkmanager, you can navigate to that directory using the “cd” command

cd C:/Android/tools/bin/sdkmanager

and then use the “sdkmanager –licenses” command to accept the licenses.

For Android Studio

If you want to resolve the “Failed to install the following Android SDK packages as some licenses have not been accepted” error using Android Studio, follow these steps:

Open Android Studio and go to the SDK Manager.

In the SDK Tools tab, select “Android SDK Command-line Tools (latest).”

Failed to install the following Android SDK packages as some licences have not been accepted Android Studio fix

After selecting the tool, click the Apply button.

ailed to install the following Android SDK packages

You might need to provide approval for the installation in the next step.

Normally, you would see a license agreement at this point. Accept the license agreement to proceed with the installation, and then click Finish to complete the setup.

ailed to install the following Android SDK packages

Please note that the exact steps might vary based on updates to the Android Studio interface. Always make sure to read any on-screen instructions or prompts.

Leave a Reply

Your email address will not be published. Required fields are marked *