Help with react native

2

I'm having an annoying error installing react native:

~/MyApp $ react-native run-android
Scanning 555 folders for symlinks in /home/henrique/MyApp/node_modules (4ms)
Starting JS server...
Building and installing the app on the device (cd android && ./gradlew installDebug)...
File /home/henrique/.android/repositories.cfg could not be loaded.
Checking the license for package Android SDK Build-Tools 23.0.1 in /home/henrique/Sdk/licenses
License for package Android SDK Build-Tools 23.0.1 accepted.
Preparing "Install Android SDK Build-Tools 23.0.1".
Warning: Failed to read or create install properties file.
Checking the license for package Android SDK Platform 23 in /home/henrique/Sdk/licenses
License for package Android SDK Platform 23 accepted.
Preparing "Install Android SDK Platform 23".
Warning: Failed to read or create install properties file.

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> Failed to install the following SDK components:
  [Android SDK Platform 23, Android SDK Build-Tools 23.0.1]
  Please install the missing components using the SDK manager in Android Studio.

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

BUILD FAILED

Total time: 13.957 secs
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/android-setup.html

I have tried to install Android SDK Platform 23, but still nothing ... Has anyone ever experienced this? Thanks in advance.

    
asked by anonymous 23.05.2017 / 01:04

1 answer

6

Create a file named local.properties and go to the android folder of your ReactNative project.

The file extension should be .properties . Put the following configuration within the file:

sdk.dir=C\:\Users\MyName\AppData\Local\Android\Sdk

Generally, Sdk is installed on this path, make sure it is correct before doing so.

If you are using Windows , use \ to enter the path.

If you are using Android Studio or have already used it, you can go to the folder of a created project, copy local.properties and paste it into the Android folder of your project > ReactNative .

If you come across the error below

  

You have not accepted the license agreements of the following SDK components: [Android SDK Platform 23, Android SDK Build-Tools 23.0.1]

You can do the following: Go to the Sdk directory, the same one that was defined in local.properties and open the tools\bin folder, directory, open CMD and do the following:

cd C:\Users\MyName\AppData\Local\Android\Sdk\tools\bin

C:\Users\MyName\AppData\Local\Android\Sdk\tools\bin>sdkmanager --licenses

It will look something like this:

  

x of and SDK package licenses not accepted   Review licenses that have not been accepted? (y / n)

Type Y and press enter . Proceed by typing Y and pressing enter to accept licenses .

    
23.05.2017 / 01:27