Rocket Chat on Android Emulator

Milind Deore
2 min readOct 21, 2024

--

To build and run the Rocket.Chat React Native application in an Android emulator, follow these step-by-step instructions:

1. Prerequisites:

Before proceeding, ensure you have the following installed:

  • Node.js: Install the latest stable version from Node.js website.
  • React Native CLI: Install using:
npm install -g react-native-cli
  • Android Studio: Download and install Android Studio from here.
  • Ensure you have installed Android SDK, AVD Manager, and a system image (such as Pixel 4 with API 30).
  • Watchman: For macOS:
brew install watchman
  • Yarn: Install via:
npm install -g yarn

2. Clone the Rocket.Chat React Native Repository:

Use Git to clone the Rocket.Chat React Native project from GitHub:

git clone https://github.com/RocketChat/Rocket.Chat.ReactNative.git
cd Rocket.Chat.ReactNative

3. Install Dependencies:

Run the following command inside the project directory:

yarn install

This installs all necessary dependencies for the project.

4. Set Up Android SDK Path:

Ensure your Android SDK is correctly set in your environment variables. Add the following to your .bashrc or .zshrc (depending on your shell):

export ANDROID_HOME=$HOME/Library/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

After updating the file, reload it with:

source ~/.bashrc  # or ~/.zshrc

5. Start Android Emulator:

Open Android Studio:

  • Go to Tools > AVD Manager.
  • Select a device or create a new one (e.g., Pixel 4 with API 30).
  • Start the emulator.

Alternatively, you can launch the emulator using the command line:

emulator -list-avds
emulator -avd <your_avd_name>

6. Run Metro Bundler:

In a separate terminal window, start the Metro bundler:

yarn start

7. Build and Run the App:

In a new terminal window, run the following command to build and deploy the Rocket.Chat React Native app to the Android emulator:

yarn android

This command will:

  • Compile the Android project.
  • Install the APK onto the emulator.
  • Automatically launch the app in the emulator.

8. Debugging:

If you face any issues, ensure:

  • The emulator is running.
  • The SDK path is set correctly.
  • Run adb devices to check if the emulator is detected.
  • Open Android Studio > Logcat to view logs.

9. Connect the App to Your Rocket.Chat Server:

  • After launching the app, enter your Rocket.Chat server URL when prompted to connect to your server.

Following these steps should allow you to build and run the Rocket.Chat React Native application successfully in the Android emulator.

Additional Resources:

  • Rocket.Chat React Native Repo: GitHub
  • React Native Getting Started: Documentation

--

--

Milind Deore
Milind Deore

No responses yet