This Article Part of React Native Tutorial Series want to start from scrach follow below link
https://infinitbility.github.io/react-native/table-of-contents
Today, we setup react native environment in windows for run react native app.
Tools
These are the tools we need on an development environment (Windows):
- Visual Studio Code (you can use any other editor or IDE)
- Android Studio
- Built-in emulator in Android Studio
- Node Package Manager (NPM)
- Node.js (Version 14 or newer)
- React Native command line interface (React Native CLI)
- Java Development Kit (JDK 8 or newer)
Install Node JS
for setup react native you have to download and instal node.js.
I recommend you install the LTS version.
Install Java SDK
Download and install the latest version of Java SDK from
https://www.oracle.com/java/technologies/javase-jdk8-downloads.html
( optional ) want to check all version of jdk
https://www.oracle.com/java/technologies/java-se-glance.html
Install Python 2
Download and install Python 2.7.15 from
https://www.python.org/downloads/windows/
-
alternative choice
You can also use Chocolatey to install Node, Python2 and Java SDK together, to do it install Chocolatey and just type:
choco install -y nodejs.install python2 jdk8
Install Android Studio
Download and install the latest version of Android Studio for Windows from https://developer.android.com/studio/
The Android Studio installs the latest Android SDK by default and React Native requires Android 6.0 (Marshmallow) SDK or higher. Once installed you can go to Tools > SDK Manager and choose any version above 6.0.
If you didn’t have any project yet (our case), you should go to Configure > SDK Manager:
Go to android sdk section
Now, go to SDK Tools tab and choose these options below:
You will need the Intel x86 Emulator Accelerator (HAXM installer) to run the emulator on Windows. For more information, please refer to the following link: https://github.com/intel/haxm/wiki/Installation-Instructions-on-Windows.
If you have Hyper-V feature enabled, you need to disable it (I know…)
Make sure if JDK location is selected. Go to File > Other Settings > Default Project Structure:
Configure environment variables
Add the ANDROID_HOME variable on environment variables:
Add JAVA_HOME variable on environment variables:
Make sure you add on Path variable the path for Java SDK and Android platform tools: C:\Users{your_user_name}\AppData\Local\Android\Sdk\platform-tools C:\Program Files\Java\jdk1.8.0_181\bin
Install React Native CLI and create the first project
npm install -g react-native-cli
Finally you can create your first React Native application by running the following command in your workspace location:
–version 0.60.4 - optional ( use when want install react native app specfic version instead latest )
react-native init myFirstReactNativeApp --version 0.55.4
Before run you project we have to configure the emulator. Take a look at the folder android. We have to open it on Android Studio:
Click on “Open an existing Android Studio project”, go to your project and select the folder android and click Ok.
If Gradle ask you to update, click on “Don’t remind me again for this project”
After open react native project on android studeio, go to Tools > ADV Manager:
after open avd manager, click on “Create Virtual Device”:
You can select any device on the list and click next:
On the next screen select the System Image. Click on download to download the selected image.
Follow the instructions and finish. After that you can see the created virtual device on the list.
Now, just click on play and you can see the emulator running:
It’s time to run your project and see it on emulator. Just type:
npx react-native run-android
Now you can edit you app and reload the emulator to see the changes, just type “ctrl + m” and click Reload:
More From React Native Tutorial
Basics
1. Introduction To React Native
2. React Native Environment Setup using expo
3. React Native Environment Setup for windows
4. React Native Environment setup on Mac OS
5. React Native Environment setup on linux
6. React Native Project Structure
Advances
4. React Native DatepickerAndroid
5. React native ScrollView scroll to position
6. How to align icon with text in react native
8. React Native Firebase Crashlytics
Error & Issue Solution
1. Task :app:transformDexArchiveWithDexMergerForDebug FAILED In React Native
2. Expiring Daemon because JVM heap space is exhausted In React Native
3. Task :app:transformNativeLibsWithMergeJniLibsForDebug FAILED In React Native
5. App crashed immediately after install react native video or track player
6. how to delete SQLite database in android react native
7. React native material dropdown twice click issue
8. How to get the current route in react-navigation?