BasedGodImran
BasedGodImran

Reputation: 1

Configure the ANDROID_SDK_ROOT environment variable

Going through process of setting up Android emulator for React Native Following React documentation on website.

Instructions are as such:

Add the following lines to your $HOME/.bash_profile or $HOME/.bashrc (if you are using zsh then ~/.zprofile or ~/.zshrc) config file:

export ANDROID_SDK_ROOT=$HOME/Library/Android/sdk export

PATH=$PATH:$ANDROID_SDK_ROOT/emulator export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools

My device: 2019 Intel MacBook Pro with macOS Monterey 12.3

I tried vim.zprofile to no avail. Honestly not sure how to proceed.

when i run react-native run-android the build always fails

Upvotes: 0

Views: 3578

Answers (1)

Pulkit Asri
Pulkit Asri

Reputation: 31

First Open the respective file from terminal using

open -a TextEdit /Users/<myname>/.bash_profile

*use .bashrc (if you are using zsh then ~/.zprofile or ~/.zshrc)

then when the text file opens add the respective lines to this text file.

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

hit save

CHECK IF THIS IS DONE CORRECTLY

  1. Type source $HOME/.bash_profile for bash or source $HOME/.zprofile to load the config into your current shell.

  2. Verify that ANDROID_SDK_ROOT has been set by running echo $ANDROID_SDK_ROOT and the appropriate directories have been added to your path by running ``echo $PATH```

Upvotes: 3

Related Questions