error starting React-Native run-android

Asked

Viewed 249 times

-1

I am trying to run a React-Native project by USB debugging on mobile phone and is giving error. I point out that I have already used 'adb Devices~ and appears the ID of my mobile phone in the terminal, but when giving the command 'Yarn React-Native run-android~ shows the following error:

FAILURE: Build failed with an Exception.

  • What Went Wrong: A problem occurred Configuring project 'app'.

    SDK Location not found. Define Location with an ANDROID_SDK_ROOT Environment variable or by Setting the sdk.dir path in your project’s local properties file at '/home/Luan/Desktop/omnistack8/tindev/android/local.properties'.

This local sdk with the Native Android files so I understand of React-Native should already come configured, which variables I would have to add in this location.properties?

  • You have configured the environment variables?

  • I had not configured correctly for what I saw, I re-did everything calmly and now gave another error when trying to run on android * What Went Wrong: A problem occurred Configuring project ':app'. > The SDK directory '/path-do-sdk/android-sdk' does not exist.

  • From the description of the error, he couldn’t find the folder you reported. See if this step by step helps you https://docs.rocketseat.dev/ambiente-react-native/android/linux

2 answers

1

You came to configure the environment variables for the user or for the machine/system?

They gave you a link that explains how to define the environment variables:

  1. ANDROID_HOME which by default is in %LocalAppData%\Android\Sdk (after installing Android Studio by selecting the Android SDK)

  2. in the variable %Path% system, not user, you have to add the following dirs:

    • %ANDROID_HOME%\platform-tools
    • %ANDROID_HOME%\emulator
    • %ANDROID_HOME%\tools
    • %ANDROID_HOME%\tools\bin

-2

Folder Android/local.properties/ put the directory where the android SDK is installed

my case sdk ta installed in the sdk.dir=/Users/joaodematejr/Library/Android/sdk folder

Browser other questions tagged

You are not signed in. Login or sign up in order to post.