$0.05

Can't not run-android react native. Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081

Ask a question+
0

Hello developer I’m new in react native in macOS catalina,
I’m facing this error when try to open react-native run-android
`* What went wrong:
A problem occurred configuring project ‘:react-native-reanimated’.

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 ‘/Users/vucms/Desktop/REACT-NATIVE/micro-controller-garden-helper/Mobile/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 12s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with —verbose flag for more details.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081`

add comment

1 Answer

0

You need to add ENVIROMENT VARIABLE to your system path
MacOS:

export ANDROID_HOME=$HOME/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH:$ANDROID_HOME/platform-tools

Windows:
The SDK Manager can be accessed from the “Welcome to Android Studio” screen. Click on “Configure”, then select “SDK Manager”.

Android Studio Welcome

The SDK Manager can also be found within the Android Studio “Preferences” dialog, under Appearance & Behavior → System Settings → Android SDK.

Select the “SDK Platforms” tab from within the SDK Manager, then check the box next to “Show Package Details” in the bottom right corner. Look for and expand the Android 9 (Pie) entry, then make sure the following items are checked:

Android SDK Platform 28
Intel x86 Atom_64 System Image or Google APIs Intel x86 Atom System Image
Next, select the “SDK Tools” tab and check the box next to “Show Package Details” here as well. Look for and expand the “Android SDK Build-Tools” entry, then make sure that 28.0.3 is selected.

Finally, click “Apply” to download and install the Android SDK and related build tools.

  1. Configure the ANDROID_HOME environment variable
    The React Native tools require some environment variables to be set up in order to build apps with native code.

Open the System pane under System and Security in the Windows Control Panel, then click on Change settings…. Open the Advanced tab and click on Environment Variables…. Click on New… to create a new ANDROID_HOME user variable that points to the path to your Android SDK:

ANDROID_HOME Environment Variable

The SDK is installed, by default, at the following location:

c:\Android\tools\bin

You can find the actual location of the SDK in the Android Studio “Preferences” dialog, under Appearance & Behavior → System Settings → Android SDK.

Open a new Command Prompt window to ensure the new environment variable is loaded before proceeding to the next step.

  1. Add platform-tools to Path
    Open the System pane under System and Security in the Windows Control Panel, then click on Change settings…. Open the Advanced tab and click on Environment Variables…. Select the Path variable, then click Edit. Click New and add the path to platform-tools to the list.

The default location for this folder is:

C:\Android\tools\bin\platform-tools

Linux:

export ANDROID_HOME=$HOME/Android/Sdk
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH:$ANDROID_HOME/platform-tools
add comment

Your Answer