Chen Li Yong
Chen Li Yong

Reputation: 6087

How to resolve the issue "Failed to install the following Android SDK packages as some licences have not been accepted."?

This is a very unnecessary issue, but here it goes.

I want to compile and run a few months old react native app. It runs flawlessly before just by a single command-line script call.

At the moment, it is stuck here:

A problem occurred configuring project ':react-native-reanimated'.
> Failed to install the following Android SDK packages as some licenses have not been accepted.
     patcher;v4 SDK Patch Applier v4
     emulator Android Emulator
     tools Android SDK Tools
     platforms;android-28 Android SDK Platform 28
     build-tools;29.0.2 Android SDK Build-Tools 29.0.2
  To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.

I look around and found that I have to accept it using sdkmanager.

I have tried to accept the licenses using `SDK manager, but it gave me "Xmlscheme error".

I look around and found that this is caused by my JDK being too new (version 15). So I degrade it to JDK 8.

Now the sdkmanager can launch, and it immediately shows:

All SDK package licenses accepted.======] 100% Computing updates...     

Now I tried to run the build script again, but the previous license acceptance error is still there.

Some answers said that it was probably because I don't have the privilege to change it, and suggest changing it using chmod 0777 on the SDK folder. I have done that. Rerun the accepting license. Rerun the build script. Still the same.

How can I fix this? SDK manager doesn't even show any license that isn't accepted. All is already accepted.

Update: I run ./sdkmanager --licenses --verbose, and it looks like every time it tries to accept licenses and it report accepted, but if I run again, it accepts the same licenses. Like... the accept result is not saved.

Update: From this comment, I have tried sdkmanager --licenses --sdk_root=~/Library/Android/sdk, and it looks like it's accepting licenses (asking whether want to accept license or not). But after accepting licenses, it's still resulting in the same issue as above.

Upvotes: 2

Views: 6557

Answers (1)

Shayan Kabiri
Shayan Kabiri

Reputation: 31

If you have not resolved this by now, here is the solution:

  1. Go to the Settings in Android Studio
  2. Go to Android SDK
  3. Select SDK Tools tab
  4. Mark and install the following packages: "Android SDK Command-line Tools", "Google Play Licensing Library" and optionally (as I am not sure whether it is necessary) "Google Play Services"

Upvotes: 3

Related Questions