Setup React Native App Development Environment on Ubuntu /Linux Without Android Studio 2024
Tags: reactnative, linux, ubuntu
Published: 2024-03-24 12:29:25

 **Setup React Native App Development Environment on Ubuntu/Linux 
**

In the world of mobile **app development**, React Native has emerged as a powerful framework for building cross-platform applications with ease. Its ability to write code once and deploy it across multiple platforms like iOS and Android makes it a favorite among developers. However, setting up a React Native development environment can sometimes be a daunting task, especially when it comes to integrating with Android Studio on Linux systems.

Fortunately, there's a way to bypass the reliance on Android Studio and streamline the setup process, specifically tailored for Ubuntu users. In this article, we'll guide you through the step-by-step process of setting up** React Native on Ubuntu without the need for Android Studio.**

### Prerequisites

Before we dive into the installation process, make sure you have the following prerequisites:

1. Ubuntu operating system installed on your machine.
2. Basic knowledge of using the terminal.
3. Stable internet connection.

### Step 1: Install Node.js and npm

Node.js and npm are essential for running JavaScript-based applications. To install them, open your terminal and run the following commands:

```bash
sudo apt update
curl -sL https://deb.nodesource.com/setup_21.x | sudo -E bash -
sudo apt install -y nodejs
```

After installation, verify that Node.js and npm are successfully installed by running:

```bash
node -v
npm -v
```

### Step 2: Install JDK (Java Development Kit)

React Native requires JDK for building and running Android applications. Install JDK by executing the following command:

```bash
sudo apt install openjdk-17-jdk
```

Verify the JDK installation by running:

```bash
java -version
```

### Step 3: Download and Install Android Command Line Tools

Instead of installing Android Studio, we'll download the Android Command Line Tools and set them up manually. Follow these steps:

1. Download the custom Android Command Line Tools from [this link](https://github.com/1xrohit/Setup-ReactNative-on-Ubuntu-without-Android-Studio/releases/download/AndroidSDK/Android.zip).
2. Extract the downloaded archive to a suitable location on your system. For example, you can extract it to `$HOME/Android`.

### Update System PATH

To ensure that the Android SDK tools are accessible from anywhere in the terminal, update the system PATH. Open the `.bashrc` file using a text editor:

```bash
nano ~/.bashrc
```

Add the following lines to the end of the file:

```bash
export ANDROID_HOME=$HOME/Android/Sdk
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/platform-tools
export PATH=$PATH:$ANDROID_HOME/cmdline-tools/latest/bin
export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64
export PATH=$PATH:$JAVA_HOME/bin
```

Save the file and reload the terminal or run `source ~/.bashrc` for the changes to take effect.

### Step 4: Install React Native CLI

React Native CLI is a command-line interface that allows you to create, build, and run React Native applications. Install it globally using npm:

```bash
npm install -g react-native-cli
```

### Step 5: Create a New React Native Project

With React Native CLI installed, you can create a new React Native project by running:

```bash
npx react-native init MyReactNativeApp
```

Replace `MyReactNativeApp` with your desired project name.

### Step 6: Run Your React Native App

Navigate to your project directory and start the Metro Bundler:

```bash
cd MyReactNativeApp
npm start
```

Open a new terminal window and run your app on an Android emulator or a connected device:

```bash
adb devices
npx react-native run-android
```

Congratulations! You have successfully set up React Native on Ubuntu without relying on Android Studio. You're now ready to dive into React Native development and build amazing cross-platform applications.

### Additional Notes

- Make sure to regularly update Node.js, npm, and other dependencies to the latest versions for optimal performance and security.
- Troubleshooting: If you encounter any issues during the setup process, refer to the official documentation or seek help from the vibrant React Native community.

With this streamlined setup, Ubuntu users can harness the power of React Native to build high-quality mobile applications without the overhead of Android Studio. 

## I hope you've found this guide helpful

Follow me on [twitter](https://x.com/1xrohit). for more tips. Happy coding!