Install React Native environment configuration in Windows, reactnative
1. install Java
Note the setting of environment variables here. You can check the environment variables based on Java-version. jdk is better than 1.8.
2. Install the SDK
Pay attention to setting the environment variable ANDROID_HOME: Android SDK Manager for example: (ANDROID_HOME => E: \ Android \ sdk) set the environment variable PATH: example: (PATH => % ANDROID_HOME % \ tools; % ANDROID_HOME % \ platform-tools)
3. Set the SDK
Open Android SDK Manager.
Select the following items:
Android SDK Build-tools version 23.0.1
Android 6.0 (API 23)
Android Support Repository
Local Maven repository for Support Libraries
The following is the formal Configuration of the RN environment.
4. Install node
This product is based on js, Node. js lightweight Web server. If you want to run React Native, you need to install node. js, go to the official website to install node. js, preferably version 4.1 or later
: Https://nodejs.org/en/
Download node. js, find the corresponding version, and then install it. I installed version 4.4.4. You can also install other
You can use the node-v command to test whether NodeJS is successfully installed.
5. Install git
Git is required to install React-native. If git is not configured, you must first download the corresponding client and add git to the path environment variable.
: Https://git-for-windows.github.io/
6. Install react-native command line tool react-native-cli
After git configuration is complete, you canclone React-native-cliWe recommend that you clone react-native-cli to a disk. Do not clone it directly on drive C.
(If the cmd cannot access the directory, how can this problem be solved ?) Let's take a look at the following:
1) enter the directory you want to install RN in the command line.
2) Inputgit clone https://github.com/facebook/react-native.git, Waiting for download
After successful clone:
3) enter the react-native-cli directory under the react-native directory under the directory just now, and enternpm install -g
After installation, you can run the react-native command on the command line.
7. Create an RN Project
Enter the directory of the project you want to create and enterreact-native init AwesomeProject, (Here AwesomeProject is the project name) Wait for a while (slow)
After successful:
Directory structure:
7. Run package
Enter the project directory in the command line and enterreact-native start, Wait for a period of time:
In this case, you can access http: // localhost: 8081/index. android. bundle? Platform = android. If it can be accessed, the server is ready.
7. Run the project
Do not close the command line that just runs package. restart a new command line,
Enter the project directory and enterreact-native run-android(Remember to open the simulator or connect to the real machine before entering this command)
Waiting for running (if this is the first time, gradle will be downloaded for a long time)
After running successfully
The simulator is shown in figure
Because my computer and mobile phone are in the same LAN, I have succeeded for the first time. However, the first mobile phone usually reports an error, as shown in figure
In this case, shake the phone, click Dev Settings, and then click Debug server host & port for device to set the IP address and port.
In the simulator, press ctrl + M (Menu) to bring up the Dev setting Menu.
The IP address here is the IP address of the computer. If you do not know it, you can enter ipconfig in the command line for query. The port number is fixed to 8081.
After setting, return to the blank page, shake your phone again, and select Reload JS to run the program. The Welcome to React Native is displayed!
Now we can start RN development, the new holo World (^ ω ^)