Dipanshu Chaubey
Dipanshu Chaubey

Reputation: 890

React Native | Failed to install the app. Please accept all necessary SDK licenses using SDK Manager

I was trying to start running my react native project. But I'm getting this error while running the react-native run-android command. I tried a bunch of solutions that I found online but neither of them worked.


info Starting JS server...
info Installing the app...

> Configure project :app
Checking the license for package Android SDK Build-Tools 28.0.3 in /home/dipanshuchaubey/Android/Sdk/licenses
Warning: License for package Android SDK Build-Tools 28.0.3 not accepted.
Checking the license for package Android SDK Platform 28 in /home/dipanshuchaubey/Android/Sdk/licenses
Warning: License for package Android SDK Platform 28 not accepted.

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> Failed to install the following Android SDK packages as some licences have not been accepted.
     build-tools;28.0.3 Android SDK Build-Tools 28.0.3
     platforms;android-28 Android SDK Platform 28
  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/dipanshuchaubey/Android/Sdk

* 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 3s

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

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> Failed to install the following Android SDK packages as some licences have not been accepted.
     build-tools;28.0.3 Android SDK Build-Tools 28.0.3
     platforms;android-28 Android SDK Platform 28
  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/dipanshuchaubey/Android/Sdk

* 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 3s

at checkExecSyncError (child_process.js:616:11)
at execFileSync (child_process.js:634:15)
at runOnAllDevices (/home/dipanshuchaubey/Documents/practice/native/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:75:39)
at buildAndRun (/home/dipanshuchaubey/Documents/practice/native/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:137:41)
at /home/dipanshuchaubey/Documents/practice/native/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:103:12
at processTicksAndRejections (internal/process/task_queues.js:89:5)
at async Command.handleAction (/home/dipanshuchaubey/Documents/practice/native/node_modules/react-native/node_modules/@react-native-community/cli/build/cliEntry.js:160:7)

How to fix this.

Thank you in Advance :)

Upvotes: 43

Views: 41261

Answers (7)

kunal pal
kunal pal

Reputation: 324

If u are using ubuntu please do this :--

1> Navigate to Android studio:- ~/Library/Android/sdk/tools/bin

2> Run this command:- ./sdkmanager --licenses

Upvotes: 6

Raikumar Khangembam
Raikumar Khangembam

Reputation: 1008

Got same issue while running react-native run-android

Navigating to the path Android/sdk/tools/bin/ and running this command doesn't fix the issues for me.

./sdkmanager --licenses

this command give this errors

sdk manager license Exception in thread "main" java.lang.NoClassDefFoundError:

My Solution:-

NOTE: i did not export java path or giving java path, just installed java and javac. I downloaded android studio package which includes all sdk. Before doing below steps when click on Tools tab of android studio i haven't seen the SDK Manager and AVD Manager Tab

Step 1: Open Android and Go to File/Setting and click Android SDK

enter image description here

Step 2: When i open first only SDK API level 30 was installed, then select API level 29 and select Apply. It downloads the API 29.

enter image description here

Step 3: Go to SDK Tools Tab which is in middle, select Android SDK Command Line Tools and Apply then Download

enter image description here

Step 4: Restart your system. Then you will see SDK Manager Tab and you can run your project.

Upvotes: 4

Kim Skogsmo
Kim Skogsmo

Reputation: 479

I have stumbled into this problem many times when starting up a new react-native project in a new environment. Most of the times, running sdkmanager --licenses isn't gonna do it because it will simply say you have already accepted all the licenses.

My react native was saying this:

Failed to install the following Android SDK packages as some licences have not been accepted.
     build-tools;28.0.3 Android SDK Build-Tools 28.0.3
     platforms;android-29 Android SDK Platform 29

However, in Android Studio > SDK Manager > SDK Tools, I noticed that I didn't have the 28.0.3 build-tools installed. Check "Show Package Details" and under SDK Build Tools, make sure you have the correct build-tools version installed.

After adding the correct version, I could again run sdkmanager --licenses, accept the licenses, and successfully start my RN project.

Upvotes: 2

Ali Rehman
Ali Rehman

Reputation: 3851

Go to Configure>SDK Manager in your Android Studio.

Select SDK Tools tab and install Google Play Licensing Library

Upvotes: 108

solomon njobvu
solomon njobvu

Reputation: 589

Have solved this by download the sdk 28 instead 29 which current ly for the android 10....

so check which version of the sdk is downloaded and download the 28 version of the sdk

Upvotes: 3

Archana Sharma
Archana Sharma

Reputation: 2071

For linux Users::

  1. Navigate TO PATH :: cd ~/Library/Android/sdk/tools/bin/ OR PATH OF YOUR Android > sdk > tools > bin
  2. Then Run the sdkmanager as follows: ./sdkmanager --licenses

And accept the licenses you did not accept yet (but need to).

For more details see the Android Studio documentation

Upvotes: 14

Joel
Joel

Reputation: 336

Open Android Studio, then click the gear icon (Configure). Press the SDK Manager option. Three tabs should be displayed, press the SDK Tools tab. After that, make sure that Android SDK Build-Tools, Android SDK Platform-Tools and Android SDK Tools are updated. Check them and press Apply.

When done, go to the terminal and navigate towards your RN project. Run react-native start then react-native run-android

Upvotes: 4

Related Questions