React Native Getting Started Debugging Project

No matter which language or framework is used, debugging is always an unavoidable topic

 

 Provides us with the function of remote debugging, and this function requires the cooperation of the Chrome browser.

 

1. First, the browser must install the React Developer Tool plugin

2. Connect the phone or open the emulator

3. Execute in the project project directory

react-native run-android

4. Open and click Dev Settings (simulator Command+m, real machine shake the phone)

5. Click Debug server host & port for device, enter

localhost:8081

 

6. Go back to the PC, if Android L or above is entered in the terminal to realize reverse proxy (it may not be possible to connect to the browser without entering Android L or above)

adb reverse tcp:8081 tcp:8081

7. Open the browser http://localhost:8081/debugger-ui/

8. command + option + i, open the developer tools, you will find the source code in this directory, and you can debug the following breakpoints (shake the phone, click Reload)

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325164603&siteId=291194637