Ever wonder how to monitor your game as it runs on the phone? Want to check out a crash? Or perhaps you've been asked to provide a log for a bug? Well, here's how...
1. If it's not already enabled, turn on USB Debugging on your phone in its settings panel.
2. Plug the phone in to your PC. Let it chime to say it has connected.
3. If required, your phone will install its drivers. Allow any driver-related prompts during this process.
4. Assuming the drivers installed okay, check Device Manager in your Windows control panel to see if any remaining issues are present.
5. If you have any yellow warning symbols next to "Android device", "Android Phone", etc., or something that references the model name of your device it's likely you're missing the ADB driver from the consumer driver package on the phone (this is unfortunately common).
From here on the guide assumes your Android SDK is installed to your C: root folder, but yours was installed wherever you told it to, so double-check where it's installed before you read on and remember to substitute your path if it differs.
6. Google have provided an ADB driver as part of the SDK set-up. It will be in C:\android-sdk\extras\google\usb_driver. Right-click the device with the warning icon and say you want to update the driver, that you want to provide the driver manually/it's already on your machine, and then point it to the folder just mentioned and click okay. Windows should now update the driver.
7. Check that the warning icon is gone from Device Manager. If not, you may need to get specific ADB drivers for your device. Try Googling "[phone model name] ADB driver" and it should point you in the right place. Obviously, prefer getting a copy from an official manufacturer download page (or at least a respectable developer community), rather than a piracy site...
If all is green in Device Manager you're okay to carry on. Close Device Manager.
8. Now in control panel again, open System. Choose Advanced System Settings and switch to the Advanced tab. Click the Environment Variables button here. In the second box here ("System Variables"), scroll down a little to find the PATH variable. Select it, then click the Edit button. Press the End key on your keyboard to jump to the end of the text-box if you're not already there. Is there a ; at the end of the text already? No? Add one.
9. Now add in "C:\android-sdk\platform-tools\" (without the quotes) and then okay everything until you get back to Control Panel.
10. Hold down your Windows key and then press R. This should open the Run dialogue. Type in "cmd" (no quotes) and press enter.
11. A command prompt will open. Type in "adb devices" (remember the space, no quotes) and press enter. You should get some response from the adb server, probably to say the server isn't running and that it's starting it up, then an odd-looking code and possibly the name of your phone. As long as it has the code, the "name" is fine even if it seems odd.
12a. If it found a device you're all set up. Type "adb logcat" and you'll see a sudden rush of text. When this has caught up with itself you'll be looking at what the phone is doing right now. Do something on the phone and watch the log respond.
12b. If you got an error about Windows not being able to find ADB, then there was a mistake made in step 8/9. Check that you put the semicolon in before the new path to platform-tools and that you included the \ at the end. Try running "adb devices" again after checking the PATHS variable is correct.
12c. If ADB is okay, but it didn't find a device, check that you turned on USB debugging, etc., on the phone and your driver is okay in control panel. You may have additional security options which you will need to set on the phone, depending on the model of your device. If all else fails, try a reboot of your PC and phone. If a reboot fails to fix it, then possibly the Google ADB driver won't work for your phone and you will need to get the specific one. Check step 7 again. In the event that you got any anti-virus/firewall prompts about talking to your phone at any point during this process, you will need to allow that communication.
13. Now that it's all working, any time you want to log something: plug your phone in, Windows+R, "cmd", "adb logcat", and watch the screen.
Tips:
If you need to provide the log for someone else it's best to clear out old log stuff first. Type "adb logcat -c" to clear the log before you type "adb logcat" to capture a new log.
Command prompt select/copy/paste is pretty awkward. Ctrl+a selects all text, pressing Enter then copies it all for you.
Command prompt too small? Right-click the icon in the top-left corner and go to the defaults section and increase the sizes here. Close/re-open to see the changes. You can edit the Properties section, but that only affects the current window and doesn't save the changes...