DEV Community

Frahaan Hussain
Frahaan Hussain

Posted on

How To Setup React Native For Android Using VSCode | Mac Apple Chip & Intel Chip

Hey Devs! 👋

Video Link:

Are you excited to dive into the world of mobile app development with React Native? Whether you're using a Mac with an Apple chip or an Intel chip, this guide will walk you through the process of setting up your development environment using VSCode. Let's get your React Native project up and running on Android!

Table of Contents

  • Prerequisites
  • Installing Homebrew
  • Setting Up Node.js and Watchman
  • Installing Android Studio
  • Setting Up VSCode
  • Creating a New React Native Project
  • Running Your App on Android Emulator
  • Troubleshooting Common Issues
  • Conclusion
  1. Prerequisites Before we begin, ensure you have the following installed on your Mac:

macOS Catalina or newer
At least 8GB of RAM
A stable internet connection

  1. Installing Homebrew Homebrew is a package manager for macOS. Open your Terminal and paste the following command to install Homebrew:

Copy code
/bin/bash -c "$(curl -fsSL"
After installation, run:

Copy code
brew --version

  1. Setting Up Node.js and Watchman Install Node.js and Watchman using Homebrew:

Copy code
brew install node
brew install watchman
Verify the installations:

Copy code
node -v
watchman -v

  1. Installing Android Studio Download and install Android Studio. During the installation, ensure the boxes for "Android SDK," "Android SDK Platform," and "Android Virtual Device" are checked.

Once installed, open Android Studio and go to Preferences > Appearance & Behavior > System Settings > Android SDK. Install the latest SDK version and build tools.

  1. Setting Up VSCode Download and install Visual Studio Code.

To enhance your development experience, install the following extensions:

React Native Tools by Microsoft
ESLint by Dirk Baeumer
Prettier - Code formatter by Prettier

  1. Creating a New React Native Project Open your Terminal and run the following commands to create a new React Native project:

Copy code
npx react-native init MyReactNativeApp
cd MyReactNativeApp

  1. Running Your App on Android Emulator Start Android Studio and open the AVD Manager (Android Virtual Device). Create a new virtual device with the desired configuration and start it.

Back in your Terminal, run:

Copy code
npx react-native run-android
Your new React Native app should now launch on the Android emulator.

  1. Troubleshooting Common Issues Error: JAVA_HOME is not set Ensure that the Java Development Kit (JDK) is installed and JAVA_HOME is set correctly. You can install it using Homebrew:

Copy code
brew install --cask adoptopenjdk/openjdk/adoptopenjdk8
Add the following to your .zshrc or .bash_profile:

Copy code
export JAVA_HOME=$(/usr/libexec/java_home)
export PATH=$JAVA_HOME/bin:$PATH

  1. Conclusion Congratulations! You've successfully set up your React Native development environment for Android on a Mac, whether you're using an Apple chip or an Intel chip. Now you're ready to start building amazing mobile apps with React Native!

If you found this tutorial helpful, don't forget to like, share, and follow for more. Happy coding! 🚀

Top comments (0)