0

I am new in React Native development. I am trying to run a project in emulator using react-native run-android. I am getting below error.

foysal@laptop:~/Videos/addbook$ react-native run-android
Starting JS server...
Building and installing the app on the device (cd android && ./gradlew installDebug)...

> Configure project :app
Observed package id 'tools' in inconsistent location '/home/foysal/Android/Sdk/tools' (Expected '/home/foysal/Android/Sdk/tools/tools')
Checking the license for package Android SDK Build-Tools 27.0.3 in /home/foysal/Android/Sdk/tools/licenses
Warning: License for package Android SDK Build-Tools 27.0.3 not accepted.
Checking the license for package Android SDK Platform 27 in /home/foysal/Android/Sdk/tools/licenses
Warning: License for package Android SDK Platform 27 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.
     platforms;android-27 Android SDK Platform 27
     build-tools;27.0.3 Android SDK Build-Tools 27.0.3
  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/foysal/Android/Sdk/tools

* 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
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
3
  • @Onik, how can I do that ? Commented Oct 20, 2018 at 14:20
  • @Onik, yes. I have installed Android Studio. Commented Oct 20, 2018 at 14:36
  • Then just run SDK Manager and install missing SDKs or accept the terms. Commented Oct 20, 2018 at 14:38

2 Answers 2

2

use "npm serve" instead "react-native run-android" and install expo app in your mobile or use genymotion emulator

Sign up to request clarification or add additional context in comments.

Comments

1
  1. Open your android studio application and select the SDK manager option from the TOOL menu.
  2. Select Android API 28 and then click on Apply button to install the android API 28 from the google server. Once you are done with installation, then you need to click on OK button.
  3. Now you can run the react native project using below commands: react-native run-android.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.