Skip to content

TBS96/ReactNative

Repository files navigation

Setup Env. variables in Env. settings(For Windows)

  • Variable:

ANDROID_HOME
  • Value:

C:\Users\prant\AppData\Local\Android\Sdk

Setup Env. variables in Env. settings(For Linux)

  • Open .bashrc file in text editor, present in home dir. & paste the following(change the username) and save it:
export ANDROID_HOME=/home/prantikg96/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
  • Open a terminal there & write the following to source it:
source ~/.bashrc
  • Verify the environment variables:
echo $ANDROID_HOME
echo $PATH
  • Initialize Project (Deprecated as of 16-08-2024): npx react-native@latest init ReactNativeApp01

  • Initialize Project (from 16-08-2024 onwards)

npx @react-native-community/cli@latest init ReactNativeApp01
  • Create local.properties under android folder & create sdk directory

  • For Windows

sdk.dir=C:\\Users\\prant\\AppData\\Local\\Android\\Sdk
  • For Linux

sdk.dir=/home/prantikg96/Android/Sdk
  • Open .gitIgnore and paste it

android/local.properties
  • Run on device or emulator (For Windows)

npx react-native run-android
  • Run on device or emulator (For Linux)

npx react-native run-android && npx react-native start