react-native Android real machine debugging

Install Android studio reference materials: https://blog.csdn.net/u014202635/article/details/55668976 (some tedious, use the download website inside, the rest follow me)

References for problems encountered by the real machine:

Solve the problem of adb: command not found on Mac: https://blog.csdn.net/weixin_38327562/article/details/71057276

react-native run-android reports an error: https://segmentfault.com/q/1010000006263128

 

1. Install Android studio:

The installation under Mac is very simple, go to the official website to download the sdk, and then download the jdk compressed package.

Extract the jdk compressed package to /Users/admin/Library/Android/sdk, and then drag the contents of the compressed package to the sdk,

Click android under tools under sdk:

Open the Android SDK Manager, currently only check the following items:

 

 

 For the rest of the installation, when you package the apk, wait for the error prompt to install, because different content will be installed according to the situation.

2. Package apk

Package apk, follow the react native official website tutorial to package, after the package is completed, there will be an app-release.apk,

Run react-native run-android, after installing some jdk according to the error prompt, it will generate app-debug.apk, this is the apk specially used for debugging on real machine,

Pass the app-debug.apk to the mobile phone to install, but the WeChat can't be installed. I passed the QQ. After installation, it is also very troublesome. . . . . .

3. After installing app-debug.apk, some problems occur on the mobile phone

Open the phone settings - "Developer options - "USB debugging, after opening, select the debug application (the app you installed), after that, you can click to enter your own app,

At this time there will still be problems, what and what overolay. . . A bunch, all you need at this time is to make all the permissions of the app to allow, and then it's fine.

Next, shake your phone and it will appear

Click on Dev Settings and select:

Fill in the IP address of your computer (the little apple in the upper left corner -> System Preferences -> Network)

At this point, the series of operations is over, shake it again, and click Reload.

Guess you like

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