Error launching application with React-Native run-android

Asked

Viewed 982 times

0

I’m trying to start with React-On I did the installation as this link https://docs.rocketseat.dev/ambiente-react-native/android/linux but when I turn the remote react-native run-android with the default application it informs the error below

   info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
    Jetifier found 855 file(s) to forward-jetify. Using 4 workers...
    info Starting JS server...
    info Installing the app...

    FAILURE: Build failed with an exception.

    * What went wrong:
    A problem occurred configuring project ':app'.
    > The SDK directory '/home/raellopes/raellopes/Android/Sdk' does not exist.

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

    error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. 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'.
    > The SDK directory '/home/raellopes/raellopes/Android/Sdk' does not exist.

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

        at checkExecSyncError (child_process.js:629:11)
        at execFileSync (child_process.js:647:13)
        at runOnAllDevices (/home/raellopes/Área de Trabalho/pessoal/projeto/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:75:39)
        at buildAndRun (/home/raellopes/Área de Trabalho/pessoal/projeto/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:169:41)
        at then.result (/home/raellopes/Área de Trabalho/pessoal/projeto/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:135:12)
        at process._tickCallback (internal/process/next_tick.js:68:7)
  • You connect your emulator with adb connect?

  • Yes ,and makes the connection correctly, but when I give the run-android React-Native it presents this error

  • 1

    By error it cannot find your Android/SDK folder

  • What should I do? I want to start studying React-Native

  • You created your Android/Sdk folder on your home? Then downloaded the android studio and pasted it inside?

  • I recommend following the React tutorial itself: https://facebook.github.io/react-native/docs/getting-started

  • No, I left it on the desktop

  • in the emulator you pointed to that folder?

  • Yes, achieve by following the link that Oce passed with the expo,

Show 4 more comments

1 answer

1


After installing the android studio as per the step by step Getting Started from React Native, go to the Android Studio app > Preferences and look for "sdk".

Download the SDK version as recommended on the React page, as well as the tools (SDK-Tools).

Now, in the root of the android folder, inside your React Native project, create a file "local.properties", and insert in it the installation directory of the android SDK.

An example of the "local.properties" directory on macos:

sdk.dir = /Users/"seu_usuario"/Library/Android/sdk

This should work, I hope you’ve clarified!

Browser other questions tagged

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