As they say, "Without a solid foundation, you will have trouble creating anything of value". In the development world, doing correct installation is of as much importance as developing the revolutionary applications π.
Today I will make sure that load of first part of your journey is shared by me π«, and help you starting the react native journey
Node JS
You can download version of Node JS according to your system preferences from this site https://nodejs.org/en/download.
After installation just run,
node --v
in your terminal to see if it's installed π.Java
Java, are we going to code in Java π±? No, but having Java on system for app development is necessary. It is because React Native uses Java for tasks like compiling the code and running the development server.
Install the Java Development Kit (JDK) from adoptopenjdk.net.
Set the
JAVA_HOME
environment variable to the JDK installation directory.Verify the installation by running
java -version
in your terminalπ.
Android Studio
Well again you might be pondering, did I come to a wrong blog? Well no my friend, we need android studio for React Native as well. It is not strictly needed but it makes our work peaceful. It installs some packages that we would have to install separately, and you know how much we hate installations π.
Download and install Android Studio from developer.android.com/studio.
During installation, ensure you install the Android SDK and Android Virtual Device (AVD) components.
Configure the
ANDROID_HOME
environment variable to point to the Android SDK location (e.g.,C:\Users\YourUsername\AppData\Local\Android\Sdk
).Add
%ANDROID_HOME%\platform-tools
to your system's PATH variable.Launch Android Studio, open the SDK Manager, and install the necessary SDK packages for your targeted Android version.
Create and start an Android Virtual Device (AVD) from the AVD Manager in Android Studio.
React Native CLI
- Install the React Native CLI globally using npm:
npm install -g react-native-cli
.
- Install the React Native CLI globally using npm:
Create a New React Native Project
Create a new React Native project using the React Native CLI:
npx react-native init YourProjectName
.Navigate into your project directory:
cd YourProjectName
.
Run Your React Native App
Connect an Android device or start your Android emulator.
Run your React Native app on Android:
npx react-native run-android
.
Troubleshooting Tips
If you encounter errors related to SDK location or missing dependencies, double-check your environment variables and SDK installations.
For issues with the Android emulator, try creating a new AVD or restarting the emulator.
Check the official React Native documentation and community forums for specific error messages or issues you encounter.