Error running React project Enable "A problem occurred Configuring project ':app'" on Linux Manjaro

Asked

Viewed 1,387 times

0

I was installing the React Native following the facebook steps, and then when I went to test with the command React-Native run-android happened this error. I’ve set up the android SDK in android studio, but the way it didn’t work, I don’t know what happened, any help I appreciate. my OS is linux manjaro, I’m beginner any mistake forgive me.

[bruno@bruno-pc AwesomeProject]$ sudo react-native run-android
info JS server already running.
info Installing the app...

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/bruno/AwesomeProject/android/local.properties'.

* 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'.
> 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/bruno/AwesomeProject/android/local.properties'.

* 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:639:11)
    at execFileSync (child_process.js:657:15)
    at runOnAllDevices (/home/bruno/AwesomeProject/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:75:39)
    at buildAndRun (/home/bruno/AwesomeProject/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:137:41)
    at then.result (/home/bruno/AwesomeProject/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:103:12)
    at processTicksAndRejections (internal/process/task_queues.js:86:5)

2 answers

2

To solve this problem of "SDK Location not found" there are two options. One of them would be to create a local.properties file inside the "Android" folder that is at the root of your project, and insert the path to the SDK. Example:

sdk.dir = /Users/USERNAME/Library/Android/sdk

However, the recommended way is to edit the . bash_profile file. Example:

export ANDROID_HOME=~/Android/Sdk
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/platform-tools

To install, take a look at this tutorial in English:

https://docs.rocketseat.dev/ambiente-react-native/android/linux

  • it’s really I hadn’t done it yet but it hasn’t worked :/

0

Browser other questions tagged

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