1. According to the official website of documentation , installation and configuration Node、Watchman、react-native cli、Android Studio
tools
2. Add the environment variable ANDROID_HOME
, PATH
path
3. Create a simulator in Android Studio
4. In the project root directory run the npm run dev:rn
compiled code to RN, if the style-related errors occur, it is because your code does not meet the constraints RN end, the compilation fails, such as inline style style="width:20;margin-right:10"
should be rewritten RN support in the form of style={{width:20,marginRight:10}}
specific styles Please refer to the constraint document
5. If not compiled automatically open the browser, then manually run the project root directory react-native start
to start Metro Bundler Server, if 8081 port is occupied, then join --port = 端口号
the specified port, open a browser and visit http://127.0.0.1:8081
, you can see the screen. Open http://127.0.0.1:8081/rn_temp/index.bundle?platform=ios&dev=true
, then you start packing
6. RN official website can be integrated into their own native application, you can also use the official shell , when using the shell, if an error occurs, we need to update npm package to the following version
7. If react-native start
you change over to run the port port
, then the port request simulator also need to make corresponding modifications
8. When debug mode is normal, install apk package to the real machine after flash back problems that may be index.android.bundle not generate the correct path or generate an error, refer to this article to solve, in addition, the project code error is also possible leading to flash back