App debugging is commonly divided into two types, wired connection to computer debugging and wireless connection to computer debugging. AR application testing usually requires movement. If we want to see the log, we need a wireless connection. So you can focus on learning wireless debugging.
Wired connection
- Turn on USB debugging on your phone
- Connect your phone and computer using a data cable
- At this time, we can see our mobile device in Unity's Build Settings, or we can see our mobile device in Android Studio, and then use Android Studio's Logcat to view the log.
Wireless connections
- Turn on USB debugging on your phone
- Use a data cable to connect your phone and computer, select file transfer, and allow debugging on the current computer
- In the case of wired debugging connection, we open cmd and run to
adb tcpip 5555
open the collected adb wireless debugging port - Run
adb connect 手机当前ip(可在当前WiFi信息里面看到):5555
and you should seeconnected to 手机当前ip(可在当前WiFi信息里面看到):5555
- If it is not connected, then try again a few times. If it is connected, we will unplug the data cable and then execute it again
adb connect 手机当前ip(可在当前WiFi信息里面看到):5555
so that the wireless connection is debugged. - Then we saw the phone in Unity and AndroidStudio.
There are two ways to view logs: using AndroidStudio’s Logcat, and using the Unity Android Logcat plug-in
Android Studio
- Install Android Studio 4.1.2
- Create a new Android application, and then we wait for AndroidStudio to download and initialize things (it may take a long time to download a lot), and we can see something called Logcat appear below.
- Then select our mobile phone to see the logs
Unity Android Logcat
- Open Window > Package Management, search Android Logcat in Unity Register, and install it.
- Open Window > Analysis > Android Logcat and then we can see
the convenience of Logcat pop-up window Unity, because our development is in Unity, we don't need to open a large Android Studio and just use it to view Logcat.