Quickly build a React Native Android development environment in Windows
Build a JAVA Development Environment
Download JDK 1.8 or later versions based on the operating system's x86 or x64 bit,
Java version for local installation: jdk-8u45-windows-x64.exe
Configure JAVA environment variables
JAVA_HOME = C: \ Program Files \ Java \ jdk1.8.0 _ 45 CLASSPATH = .; % JAVA_HOME % \ lib \ dt. jar; % JAVA_HOME % \ lib \ tools. jar; path added; % JAVA_HOME % \ bin; % JAVA_HOME % \ jre \ bin;
Install Android Studio
Android Studio version: androidstudio1.5.0.0.1454148047.exe
Add environment variable configuration for Android SDK
ANDROID_HOME = D: \ Android \ sdkpath added; % ANDROID_HOME % \ tools; % ANDROID_HOME % \ platform-tools;
Install Git Version Control
Git version for local installation: Git-1.9.5-preview.exe
Install Virtual Machine
Virtual Machine version during local installation: genymotion-2.6.0-vbox
This software requires you to register an account on the official website before you can download it. Official website address: www.genymotion.com/
Install React-native-cli
npm install -g react-native-cli
Initialize a project
react-native init reactNative
Start the project
react-native start
Run the preceding command to open the following connection:
Http: // localhost: 8081/index. android. bundle? Platform = android
On the page:
This page indicates that the android project has not been compiled successfully.
You need to delete the files in this path under the project (MyProject: myProject \ node_modules \ react-native \ node_modules \ react-transform-hmr \ node_modules \ react-proxy \ node_modules \ react-deep-force-update \. babelrc
For example:
Close the cmd window and run react-native start again. Press enter.
The following figure shows the connection address page.
If you execute react-native start, an error may be reported:
Solution:
Modify this file F: \ reactNative \ MyReact \ node_modules \ react-native \ packager \ react-packager \ src \ DependencyResolver \ FileWatcher \ index. js
Set the original
Const MAX_WAIT_TIME = 120000;
Change
Const MAX_WAIT_TIME = 120000000;
Run android app
react-native run-android
Running may take some time. Be patient
Android debugging
Currently, chrome cannot be automatically enabled for debugging in Windows, so you can manually open chrome and access the following url: http: // localhost: 8081/debugger-ui.