Debugging with Android Debug Bridge


Ashley Kwon (Spring 2023)

Android debug bridge (ADB) is a useful tool that you can use to debug your Unity project, especially if you are using C# scripts. ADB helped me detect bugs that only occur when I run my apps on an Oculus headset, which are often difficult to spot simply by running the apps through the Unity editor on my desktop. To use this debugging tool, you need the following:

adb.exe devices

6. In your terminal, type the following statement, but don't run it yet. debuggingLog is the name of the text file where the log that results from running your Unity app, including Debug.Log statements, are printed. Please feel free to replace debuggingLog to another name that easier for you to identify.

adb.exe logcat > debuggingLog.txt

7. Build and run your Unity app through Unity editor. 

8. Once the app starts running in your headset, run the statement you typed in 6.

9. When you finish running your app in your headset, stop the command that is currently running in your terminal using command + C or ctrl + C. This will ensure that no other statements get printed in your text file when your app is not running.

10. Navigate to the folder where you created your txt file and open the file. Use command + F or ctrl + F to find the Debug.Log statement(s) you wrote in your C# file. In the example from 5, if my app successfully accessed my right joystick whenever I moved it, the txt file should contain lines that read "right joystick triggered"