Disclaimer: React native built with Windows can only be developed for Android applications
1. Ready to install Java JDK and Android SDK
Portal: Java JDK Android SDK (search by yourself)
A. Set the system environment variables for Java: java_home (point to JDK directory) path (point to JDK Bin directory) Classpath:.; %java_home%\lib\dt.jar;%java_home%\lib\tools.jar
These system variable names are case insensitive
B. Setting android_home user Environment variables: pointing to the Android SDK installation directory
These settings take effect when the DOS window is turned off
2. Install Android Simulator, recommended Genymotion
Portal: Genymotion
You're going to hit a lot of holes here.
First, build a Google Nexus 5.0+ simulator on the genymotion.
Second, if your Windows is 64-bit, set the system to 64-bit when configuring VirtualBox, and if there is no 64-bit option, enter BIOS to set virtualization to enable
Then upgrade your graphics card driver or turn your graphics card hardware acceleration to maximum, tick enable vt-x/amd-v in hardware acceleration, system-to-machine settings
Then turn on the VirtualBox, the Black dialog box appears and show that the virtual machine is assigned a good IP, and then start the Genymotion simulator so that the simulation started smoothly.
3. Install NODEJS version 4.0 or above
Portal: Nodejs
4. Installing the React-native CLI with Nodejs NPM
Install -G react-native-cli
5. Initialize the React native project
React-native Init Awesomeproject
This initial success rate is low, if the initialization is problematic, then go to the following Git repository to get
https://github.com/chenyangcun/AwesomeProject.git
6. Start React native Project
In DOS, enter the folder where the project is located, and then run: react-native start
If a watcher took too long to load error appears
Then the \node_modules\react-native\packager\react-packager\src\filewatcher in the project will change the timeout field in the index.js to a larger size.
7. Deploy the project to the emulator
Under the premise of opening the emulator, enter the Android folder of the project directory in DOS
Run: Gradlew.bat installdebug
If you are too slow to download jcenter, consider using a MAVEN image
Open the project directory Build.gradle the inside of the allprojects->repositories in the Jcenter () replaced
maven{url ' http://maven.oschina.net/content/groups/public/'}
After the project has been successfully started
Go to the simulator and open the app.
React native Windows build (full version)