Cannot build android as some licenses have not been accepted

Viewed 80

I'm trying to setup an android command line compiler in a linux machine, so I downloaded the command line tools for Android, and downloaded the Android 12 platform (android-31), as well as all the build tools.

I decided to have a system wide installation, so I did the process in /opt/android-sdk. And of course I wrote the ANDROID_SDK_ROOT variable to point to that path. Once finished the installation, I accepted the licenses with sdkmanager --licenses.

As it was a system wide installation, I set the ownership of the /opt/android-sdk folder (and all subfolders) to root:android. So all users in group android can read/write those files.

Now, when I try to compile a project, it gives the following error:

Failed to install the following Android SDK packages as some licences have not been accepted.
     patcher;v4 SDK Patch Applier v4
     emulator Android Emulator
     platforms;android-31 Android SDK Platform 31
     tools Android SDK Tools
     build-tools;31.0.0 Android SDK Build-Tools 31
     platform-tools Android SDK Platform-Tools
  To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
  Alternatively, to transfer the license agreements from one workstation to another, see http://d.android.com/r/studio-ui/export-licenses.html
  
  Using Android SDK: /opt/android-sdk

If you see the list of installed packages:

Installed packages:
  Path                 | Version | Description                    | Location
  -------              | ------- | -------                        | -------
  build-tools;30.0.3   | 30.0.3  | Android SDK Build-Tools 30.0.3 | build-tools/30.0.3
  build-tools;31.0.0   | 31.0.0  | Android SDK Build-Tools 31     | build-tools/31.0.0
  emulator             | 30.9.5  | Android Emulator               | emulator
  patcher;v4           | 1       | SDK Patch Applier v4           | patcher/v4
  platform-tools       | 31.0.3  | Android SDK Platform-Tools     | platform-tools
  platforms;android-31 | 1       | Android SDK Platform 31        | platforms/android-31

And the licenses folder:

-rwxrwxr-x 1 root android 41 Nov 18 10:34 android-googletv-license
-rwxrwxr-x 1 root android 41 Nov 18 10:34 android-sdk-arm-dbt-license
-rwxrwxr-x 1 root android 41 Nov 18 10:30 android-sdk-license
-rwxrwxr-x 1 root android 41 Nov 18 10:34 android-sdk-preview-license
-rwxrwxr-x 1 root android 41 Nov 18 10:34 google-gdk-license
-rwxrwxr-x 1 root android 41 Nov 18 10:34 mips-android-sysimage-license

Is there something that I'm missing? Any kind of permission error or any step that I need to do?

When I downloaded the packages, it asked for confirmation on the license for platforms;android-31, but no any other package. Maybe there was something missing in at that moment.

0 Answers
Related