Remark:
Before debugging, you need to check whether the environment variables of java and SDK are OK
Enter java and adb detection in CMD
Official documentation:
https://docs.unity3d.com/Manual/AttachingMonoDevelopDebuggerToAnAndroidDevice.html
start adb:
Open the adb.exe directory, start adb through the cmd command, and enter the following command.
adb tcpip 5555
Link mobile phone ip:
adb connect 192.168.151.4
The cmd output is as follows:
Unity settings are as follows:
Real machine joint debugging:
First run the apk-profile interface and click editor-select the phone ip you just entered. In this way, the real machine can be connected.
Remark:
When changing the joint debugging of the mobile phone, you can kill the connection through kill-server.
adb kill-server
Debugging with the Night God Simulator
1. Download and install the emulator, and set it up
- Download and install the latest Night Simulator
- Turn on the developer mode (Settings-About Tablet PC, click the version number 5 times to open the developer options)
- Turn on USB debugging (Developer-USB debugging)
- Open the location of the emulator and execute the command (nox_adb.exe connect 127.0.0.1:62001, display connect to ... or already connected to ... are all connected successfully) (if it fails, you can try 52001)
2. ADB version mismatch solution
After following the above steps, the following problems are displayed:
View the ADB version command: adb --version
Copy adb.exe and rename it to nox_adb.exe, replacing nox_adb.exe in the emulator.
Reconnecting after closing the emulator and restarting will solve the problem of ADB version mismatch.
3. Unity packaging settings
You can choose to run the device directly to the emulator, so you don't need to manually install the APK
Profiler debugging does not need to connect by entering IP, you can directly select AndroidPlayer to debug directly
Remark:
If debugging stops, it can be resumed by switching modes.
ADB Logcat
1. Run the emulator first
2. Open the emulator installation directory, run the CMD command, the content is as follows
D:\Program Files\Nox\bin>nox_adb.exe devices
List of devices attached
127.0.0.1:62001 device
D:\Program Files\Nox\bin>adb connect 127.0.0.1:62001
already connected to 127.0.0.1:62001
D:\Program Files\Nox\bin>adb devices
List of devices attached
127.0.0.1:62001 device
D:\Program Files\Nox\bin>adb logcat -c
D:\Program Files\Nox\bin>adb logcat *:w > E:\cash.log
adb logcat -c clear the log
adb logcat *:w > E:\cash.log Output log to questionnaire, filter level warning
Some logcat analysis: