One of the most important tools in Android is the ADB (short for “Android Debugging Bridge”). This tool comes together with the Android SDK. Even more important is its logcat tool. Logcat is very useful when it comes to identifying errors and problems in Android. However, since logcat is an ADB tool, it is loaded AFTER the kernel and init is loaded. That said, it is excellent in resolving issues AFTER the kernel has loaded. Lets dig into how to get ADB installed and running the logcat. Thankfully, ADB supports al three major platforms – Linux, MacOSX and Windows.
Step 1 : Download the Android SDK from here. Link opens in a new window.
Step 2 : Extract the downloaded ZIP file to a location you will remember.
Step 3 : Include the tools path to the global variable (explained below)
A. Using Command Prompt (cmd)
B. Using Graphical User Interface (GUI)
If command prompt is not your thing, there is an easier method to do this. Follow the steps:
For WinVista and Win7
Step 4 : Run the SDKSetup.exe in the Android SDK folder and you should see your SDK version listed as installed in the window.
Step 5 : Now go to settings and check the box that says “Force https:// … to Be fetch sources using http:// …” and then select “Save & Apply”.
Step 6 : Now go to “Available Packages” and hit the “Refresh” package. Mark the listed packages and then hit “Install Selected” button.
That’s it! Now the SDK has been successfully installed. Now, since ADB is a “debugging” tool, you need to allow debugging on the phone too. To do this, on your phone, go to the following location:
Settings -> Applications -> Development
Check the “USB Debugging” box.
Now, run the cmd / Terminal application again. Type the following command:
If you see your device listed, it means everything is working perfectly.
Now, to create a logcat, this is the command that you may execute:
adb logcat > logcat.txt
The whole logcat log will be saved at the path that you ran this command at. For example, if you ran this command when your prompt was at C:\Desktop>, then it will be saved at C:\Desktop\logcat.txt. This logcat.log file can then be used to identify the problem that is occuring. To stop the log, press ( ctrl + . ) ctrl key with the period key.
If you are filing a logcat for force close, you should start the logcat using the command above first, then initiate the force close action, then stop the logcat. This way, the force close instance will be captured within the log and can be sent to the developers accordingly.
ADB has a bunch of very useful commands that you can use for various purposes. Here are some of them that you might find handy.
Questions? Suggestions? Appreciation? Feel free to comment.