Setup Env. variables in Env. settings(For Windows)
C:\U sers\p rant\A ppData\L ocal\A ndroid\S dk
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:
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
sdk.dir=C:\\ Users\\ prant\\ AppData\\ Local\\ Android\\ Sdk
sdk.dir=/home/prantikg96/Android/Sdk
Open .gitIgnore
and paste it
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