React Native Installation Guide & Run in Android Device

Install 3 Things for React Native Installation

  • visual studio code [vscode]

  • Java [openjdk]

  • Android studio for adb

Step 1: Check NodeJS and Java is installed (or) not if not install the nodejs and java using chocolatey.

  • node --version

  • java --version

Step 2: Install Chocolatey Link: https://chocolatey.org/install#individual While Installing Chocolatey use the Window Powershell in administrator mode follow the commands in link i have given.

Step 3: choco install -y nodejs-lts microsoft-openjdk17

  • node --version

  • java --version

Step 4: Install Android Studio from official documentation after the set some environment path like user variables & system variables.

  • User Environment Variables:

    • ANDROID_HOME : C:\Users\chakr\AppData\Local\Android\Sdk

    • PATH : C:\Users\<USERNAME>\AppData\Local\Android\Sdk\platform-tools

    • PATH : C:\Users\<USERNAME>\AppData\Local\Android\Sdk

    • PATH : C:\Users\<USERNAME>\AppData\Local\Android\Sdk\emulator

    • PATH : C:\Users\<USERNAME>\AppData\Local\Android\Sdk\tools

    • PATH : C:\Users\<USERNAME>\AppData\Local\Android\Sdk\tools\bin

  • System Environment variables:

    • PATH : C:\Users\<USERNAME>\AppData\Local\Android\Sdk

    • PATH : C:\Users\<USERNAME>\AppData\Local\Android\Sdk\platform-tools

Step 4: CMD : adb --version [ Check After Android Install and Environment Variables Set in User/System Variables ]

Step 5: Create Folder/Directory in Laptop/Desktop & execute this CMD: npx react-native init newapp & cd newapp & npx react-native run-android (or) npm run android

Step 6: Connect Mobile Device Into Computer/Laptop for Android Apps Install on Mobile Device

  • Tap 5 times on Build Number it enables the developer options.

  • In the developer options enable the USB debugging.

    • Instructions to run app in android after react-native project creation

    • Run instructions for Android:

      • Have an Android emulator running (quickest way to get started), or a physical device connected [using cable to physical phone].

        • First Connect Physical Mobile Device to Laptop/Desktop using the Using Cable Then Proceed next two steps

        • go to developer option enable the usb debugging mode.

        • got to developer change the default usb configuration in developer options only : file transfer / android studio.

      • In Laptop/Desktop CMD: adb devices [To check no of devices connected to laptop / Desktop].

      • CMD: adb devices -l [To check no of devices connected to Laptop/Desktop in long listing].

      • In Laptop/Desktop CMD: cd project_directory && npx react-native run-android.

      • If we receive any error while installing react native app in physical mobile device execute the below command and run app on android once again

      • CMD: cd android [To get into the android directory in project directory] <!-- CMD: cd android && ./gradlew clean -->

      • CMD: ./gradlew clean

      • CMD: npm run android [To run the app on physical mobile device]

0
Subscribe to my newsletter

Read articles from Jallu Chakravarthi directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Jallu Chakravarthi
Jallu Chakravarthi