[Solved] Ubuntu20.04 Error: “Failed to install the following Android SDK packages as some licences have not..“error

After installing Android studio under Ubuntu, importing the project and building, the following error appears:

The problem is that licenses are not matched well

There are only two steps to solving the problem:

1. Open file – & gt; Settings

After the settings interface appears, enter appearance – & gt; System Settings -> Android SDK -> SDK Tools

Download Android SDK command line tools (latest) in SDK tools interface

2. After downloading, CMD line tools will be installed in the SDK directory ~/Android/SDK by default. If your directory is different, you need to modify it accordingly

Execute on the command line

yes | sudo ~/Android/Sdk/cmdline-tools/latest/bin/sdkmanager --licenses

The problem is solved. Build can run normally

Note: 1. In some articles, you can directly run the sdkmanager under ~/Android/SDK/tools/bin /, which will report an error


The reason is that Ubuntu 20.04 installs OpenSDK 11 by default, which will conflict with the JRE that comes with Android Studio.
Uninstalling OpenSDK 11 and installing a lower version of JavaSDK is more troublesome.

Read More: