React-native Windows environment Build record

Source: Internet
Author: User
Tags android sdk manager

1. installing the JDK,SDK

JDK:http://www.oracle.com/technetwork/cn/java/javase/downloads/jdk8-downloads-2133151-zhs.html

SDK:http://www.android-studio.org/

JDK to be 1.8 or above. Then configure the corresponding environment variables. One thing to note:jdk and JRE cannot be installed in the same directory.

To configure environment variables:

Android_home:location ofAndroid SDK Manager (ex:D:\Android\sdk)

PATH: %android_home%\tools;%android_home%\platform-tools

Java_home=c:\program files\java\jdk1.8.0_45
Path+=%java_home%\bin;%java_home%\jre\bin;
Classpath+=%java_home%\lib\dt.jar;%java_home%\lib\tools.jar;

after the command line input:adb test whether the SDK is configured successfully

2. setting up the SDK

Android SDK build-tools version 23.0.1 (for The sake of insurance I'm putting it . it's all down. )

There is a wall problem with Google Mirror, so:

Download using a domestic image:

Dalian Neusoft Institute of Information Mirror server address :

http://mirrors.neusoft.edu.cn Port: tested, can be used

3, install node,git,Python,android Studio

Direct Officer Net download can

: https://nodejs.org/en/

: https://git-for-windows.github.io/

: https://www.python.org/downloads/release/python-2710/

:http://www.android-studio.org/

4. install the react-native command-line tool react-native-cli

Create a React Native dedicated folder,

Enter the folder, open the system command line in the folder, enter:npm install-greact-native-cli

5, create reactnative Project

in the React Native dedicated folder into the system command line, enter react-native init awesomeproject

6. Run the Package

Enter Awesomeproject folder, open the command line within the folder,

Input:react-native start

this time with a browser access http://localhost:8081/index.android.bundle?platform=android ,

If you can access the server side and display a lot of code, it means you are successful.

This is a very pit step and sometimes stops at Loading dependency graph, done. it's not moving.

7, run to emulator

Open the simulator first ( I am using the emulator of Android Studio ) to keep the connection state.

The last step of the window to keep, do not close (close will not go to that site).

then open a line of command-line window, enter:react-native run-android

8.Problems encountered

(1), Unable to detect the analog device, the port is occupied

D:\ANDROID-SDKS\PLATFORM-TOOLS>ADB Kill-server-- stop adb service
D:\ANDROID-SDKS\PLATFORM-TOOLS>ADB Start-server-- open adb service

find a list of devices:ADB devices

(2), launch Android Simulator error to install Intel HAXM

Restart the computer, and enter the boot interface before pressing F2/esc/del (different computers in different ways ) Enter the BIOS of the computer to ensure that Intel virtual technology is set to the Enable state (that is, allow virtual machine technology):

and then come back and install HAXM can:

(3), installation gradle error

Workaround:1, first Download the corresponding version of the Gradle to any local disk (I am here Gradle-2.14.1-all), and then put it in a disk

, 2, and then replace the android/gradle/wrapper/gradle-wrapper.properties Distributionurl in the project ,

that is distributionurl=file\:///d:/gradle/gradle-2.14.1-all.zip (note that the escape character must be added here \)

3. then it's OK .

React-native Windows environment Build record

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.