1

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.

Chen Li Yong
  • 5,459
  • 8
  • 58
  • 124

1 Answers1

2

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"
  • I have resolved it. Turns out I have two kind of Java, one is JRE, one is JDK. So each time I accept the license, the resulting acceptance always go to the JRE, which is why the JDK keeps complaining they're still haven't accepted yet. After much work to uninstalling both JRE and JDK, and installing fresh JDK 8 (because of other issues), I finally managed to get this right. – Chen Li Yong Aug 05 '21 at 02:09
  • Your solution fixed my issue, thank you. – sp_nz Dec 18 '21 at 06:29