Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Please accept all necessary Android SDK licenses

Setting up a React Native development environment on Windows for the first time, I create a new React Native project, cd into it, and run react-native run-android. I receive the error:

info Starting JS server... The system cannot find the path specified. info Launching emulator... error Failed to launch emulator. Reason: No emulators found as an output of emulator -list-avds. warn Please launch an emulator manually or connect a device. Otherwise app may fail to launch.

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.bat app:installDebug -PreactNativeDevServerPort=8081

I've tried:

  • Go to Configure>SDK Manager in your Android Studio. Select SDK Tools tab and install Google Play Licensing Library
  • 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.
  • Installing v28 of Android SDK and opened a Pixel 2 VD running v28.
  • Run Powershell C:\users\steve\appdata\local\Android\Sdk\tools\bin> ./sdkmanager.bat --licenses. I receive the error:

Warning: File C:\Users\steve\ .android\repositories.cfg could not be loaded. All SDK package licenses accepted.======] 100% Computing updates...

I've created a blank C:\Users\steve\ .android\repositories.cfg file, and started an Android emulator through Android Studio, but receive the same error.

like image 546
Steve Avatar asked Mar 03 '23 03:03

Steve


1 Answers

  • Install latest JDK -- installation link
  • export JAVA_HOME and ANDROID_HOME environment variables setup link

if you are windows machine run following command

cmd.exe /C"%ANDROID_HOME%\tools\bin\sdkmanager.bat --licenses" 

if you are macOS run following command

yes | sudo ~/Library/Android/sdk/tools/bin/sdkmanager --licenses
like image 88
Muhammad Iqbal Avatar answered Mar 05 '23 16:03

Muhammad Iqbal