Hadock
Hadock

Reputation: 966

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

In my ubuntu I have installed Android SDK & OpenJDK 11 for a react native project.

In my .zshrc I have set the PATH like this :

export ANDROID_SDK_ROOT="$HOME/Android/cmdline-tools/tools/bin"
PATH="$PATH:$ANDROID_SDK_ROOT"

When I run sdkmanager --version I have 3.0 in response (my path seems ok).

The problem is very strange, when I run sdkmanager --licenses I have the following result All SDK package licenses accepted.======] 100% Computing updates...

But when I run yarn android in my project I have the following error :

> Configure project :react-native-reanimated
Checking the license for package SDK Patch Applier v4 in /home/hadock/Android/cmdline-tools/tools/bin/licenses
Warning: License for package SDK Patch Applier v4 not accepted.
Checking the license for package Android Emulator in /home/hadock/Android/cmdline-tools/tools/bin/licenses
Warning: License for package Android Emulator not accepted.
Checking the license for package Android SDK Platform-Tools in /home/hadock/Android/cmdline-tools/tools/bin/licenses
Warning: License for package Android SDK Platform-Tools not accepted.
Checking the license for package Android SDK Tools in /home/hadock/Android/cmdline-tools/tools/bin/licenses
Warning: License for package Android SDK Tools not accepted.
Checking the license for package Android SDK Build-Tools 29.0.2 in /home/hadock/Android/cmdline-tools/tools/bin/licenses
Warning: License for package Android SDK Build-Tools 29.0.2 not accepted.
Checking the license for package Android SDK Platform 29 in /home/hadock/Android/cmdline-tools/tools/bin/licenses
Warning: License for package Android SDK Platform 29 not accepted.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.3/userguide/command_line_interface.html#sec:command_line_warnings

FAILURE: Build failed with an exception.

* Where:
Build file '/home/hadock/samus/Projects/rm/rm-app/node_modules/react-native-reanimated/android/build.gradle' line: 89

* What went wrong:
A problem occurred configuring project ':react-native-reanimated'.
> Failed to install the following Android SDK packages as some licences have not been accepted.
     platform-tools Android SDK Platform-Tools
     patcher;v4 SDK Patch Applier v4
     emulator Android Emulator
     platforms;android-29 Android SDK Platform 29
     tools Android SDK Tools
     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.
  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: /home/hadock/Android/cmdline-tools/tools/bin

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 5s

error Failed to install the app. Please accept all necessary Android SDK licenses using Android SDK Manager: "$ANDROID_HOME/tools/bin/sdkmanager --licenses". Run CLI with --verbose flag for more details.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081

error Command failed with exit code 1.

It's look like some licenses is not signed but the command for that tell me everything is ok.

For information :

the yarn android launch react-native run-android

my sdkmanager is store in ~/Android

hadock in ~/Android 
➜ ls
build-tools  cmdline-tools  emulator  licenses  patcher  platforms  platform-tools  tools

hadock in ~/Android 
➜ tree cmdline-tools/bin 
cmdline-tools/bin
├── apkanalyzer
├── avdmanager
├── lint
├── screenshot2
└── sdkmanager

0 directories, 5 files

sdkmanager --list (a part of)

Installed packages:=====================] 100% Computing updates...             
  Path                 | Version | Description                    | Location             
  -------              | ------- | -------                        | -------              
  build-tools;29.0.2   | 29.0.2  | Android SDK Build-Tools 29.0.2 | build-tools/29.0.2/  
  build-tools;29.0.3   | 29.0.3  | Android SDK Build-Tools 29.0.3 | build-tools/29.0.3/  
  emulator             | 30.4.5  | Android Emulator               | emulator/            
  patcher;v4           | 1       | SDK Patch Applier v4           | patcher/v4/          
  platform-tools       | 31.0.0  | Android SDK Platform-Tools     | platform-tools/      
  platforms;android-29 | 5       | Android SDK Platform 29        | platforms/android-29/

my config (neofetch)

➜ neofetch                                                      
           `.:/ossyyyysso/:.               hadock@hadock-legion 
        .:oyyyyyyyyyyyyyyyyyyo:`           -------------------- 
      -oyyyyyyyodMMyyyyyyyysyyyyo-         OS: Kubuntu 20.10 x86_64 
    -syyyyyyyyyydMMyoyyyydmMMyyyyys-       Host: 81FV Lenovo Legion Y530-15ICH 
   oyyysdMysyyyydMMMMMMMMMMMMMyyyyyyyo     Kernel: 5.8.0-44-generic 
 `oyyyydMMMMysyysoooooodMMMMyyyyyyyyyo`    Uptime: 2 hours, 42 mins 
 oyyyyyydMMMMyyyyyyyyyyyysdMMysssssyyyo    Packages: 2333 (dpkg), 18 (snap) 
-yyyyyyyydMysyyyyyyyyyyyyyysdMMMMMysyyy-   Shell: zsh 5.8 
oyyyysoodMyyyyyyyyyyyyyyyyyyydMMMMysyyyo   Resolution: 1920x1080 
yyysdMMMMMyyyyyyyyyyyyyyyyyyysosyyyyyyyy   DE: Plasma 5.19.5 
yyysdMMMMMyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy   WM: KWin 
oyyyyysosdyyyyyyyyyyyyyyyyyyydMMMMysyyyo   WM Theme: Layan 
-yyyyyyyydMysyyyyyyyyyyyyyysdMMMMMysyyy-   Theme: Breeze Dark [Plasma], Breeze-Dark [GTK2], Breeze [GTK3] 
 oyyyyyydMMMysyyyyyyyyyyysdMMyoyyyoyyyo    Icons: Fluent [Plasma], Fluent [GTK2/3] 
 `oyyyydMMMysyyyoooooodMMMMyoyyyyyyyyo     Terminal: konsole 
   oyyysyyoyyyysdMMMMMMMMMMMyyyyyyyyo      Terminal Font: JetBrains Mono NL 10 
    -syyyyyyyyydMMMysyyydMMMysyyyys-       CPU: Intel i5-8300H (8) @ 4.000GHz 
      -oyyyyyyydMMyyyyyyysosyyyyo-         GPU: Intel UHD Graphics 630 
        ./oyyyyyyyyyyyyyyyyyyo/.           GPU: NVIDIA GeForce GTX 1050 Ti Mobile 
           `.:/oosyyyysso/:.`              Memory: 3281MiB / 15883MiB 

                                                                   
                                                                  

If you want more information feel free to ask.

I have already check some other response like :

Upvotes: 0

Views: 3147

Answers (1)

Peter Dobrinov
Peter Dobrinov

Reputation: 41

I was just dealing with this. My problem was that was the build was expecting the licenses to be another location, probably the $ANDROID_HOME.

Check where is your license directory at the moment, and check where the build is expecting it to be. In my case, the licenses were here:

Android/android-sdk-linux/cmdline-tools/licenses

But the SDK were expecting them to be at:

Android/android-sdk-linux/licenses

You can specify where the accepted licenses can be with:

./sdkmanager --licenses --sdk_root=/home/jenkins/Android/android-sdk-linux/

Upvotes: 4

Related Questions