Welcome! This guide will help you set up and run this already-initialized React Native project (from GitHub) on your Windows or macOS computer for Android development.
Before we begin, make sure you have the following installed:
- Download and install from: https://nodejs.org
- After install, open a terminal or command prompt and run:
node -v
npm -v
You should see version numbers if it worked.
*R eact Native also requires Java SE Development Kit (JDK), which can be installed using Chocolatey.
- Open an Administrator Command Prompt (right click Command Prompt and select "Run as Administrator"), then run the following command:
choco install -y microsoft-openjdk17
- If you have already installed Node on your system, make sure it is Node 18 or newer. If you already have a JDK on your system, we recommend JDK17. You may encounter problems using higher JDK versions.
-
Download from: https://developer.android.com/studio
-
During installation, select these:
- Android SDK
- Android SDK Platform
- Android Virtual Device (AVD)
Note: This guide is for React Native CLI, not Expo.
Install it globally:
npm install -g react-native-cli
Open a terminal or command prompt and run:
git clone https://github.com/VoicenterTeam/opensips-react-native-demo.git
cd opensips-react-native-demo
Replace the GitHub link with your actual repo URL.
Inside the project folder, run:
yarn
or
npm install
This will install all required packages listed in package.json
.
Add the following to your environment variables:
-
ANDROID_HOME =
C:\Users\YourName\AppData\Local\Android\Sdk
-
Add these to your System PATH:
%ANDROID_HOME%\emulator
%ANDROID_HOME%\tools
%ANDROID_HOME%\tools\bin
%ANDROID_HOME%\platform-tools
On macOS, this step is usually handled automatically by Android Studio.
- Open Android Studio
- Go to Tools > Device Manager
- Launch a virtual device (or connect your Android phone with USB debugging enabled)
In the terminal (inside the project folder), run:
yarn run android
or
npx react-native run-android
This will build and install the app on your emulator or connected device.
If you prefer using the graphical interface of Android Studio:
1.In the terminal (inside the project folder), run:
yarn start
or
npx react-native start
- Open Android Studio
- Click File > Open and select the
android
folder from the cloned project - Wait for the Gradle sync to complete (may take a few minutes)
- On the top toolbar, select a running device or emulator
- Click the green "Run"
▶️ button (or press Shift + F10)
This will build and run the app using Android Studio.
Ensure ANDROID_HOME
is set correctly and tools are added to your system PATH.
- Try running
npx react-native start
in a new terminal. - Make sure the emulator or your phone is connected and recognized.
- Start Metro bundler:
yarn start
- Clean Android build:
cd android && gradlew clean
(Windows) or./gradlew clean
(macOS/Linux) - Re-run the app:
yarn run android
You can generate a standalone APK file to install manually or share with others:
cd android
./gradlew assembleRelease # for macOS/Linux
gradlew assembleRelease # for Windows
This may take a few minutes. When it's done, your APK file will be here:
android/app/build/outputs/apk/release/app-release.apk
You can now copy that file to your Android device or share it with others.
Note: To avoid errors, make sure you’ve set up signing configs or comment out the
signingConfig
inandroid/app/build.gradle
if you're just testing.
If everything is set up correctly, you should now see the app running on your Android device.
If you have any issues, check the React Native documentation or search online using the error message.