ADB installation and how to logcat

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 2 : Extract the downloaded ZIP file to a location you will remember.

Step 3 : Include the tools path to the global variable (explained below)

Adding Variables

Windows

A. Using Command Prompt (cmd)

Hit the “Start” button. Select “Run..” then type “cmd” or just type “cmd” if you are using beyond Win XP.

Once the cmd has opened, assuming you have extracted the package to C:\AndroidSDK and the tools folder location is at C:\AndroidSDK\tools, type this command in the cmd. You may need to alter the bold text.

set PATH=%PATH%;c:\AndroidSDK\tools

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 WinXP

Right click on My Computer

Select Properties

Select the Advanced Options tab

Click the Environment Variables

Click the edit button of the path

Add the location C:\AndroidSDK\tools at the end of the variables string. Note : You may notice other environment variables in this field too. They should be separated with a semicolon “;“.

For WinVista and Win7

Right click on Equipment

Select Properties

Select Advanced System Settings

Select Advanced Options

Click the Environment Variables

Click the edit button of the path

Add the location C:\AndroidSDK\tools at the end of the variables string. Note : You may notice other environment variables in this field too. They should be separated with a semicolon “;“.

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.

Executing ADB

Now, run the cmd / Terminal application again. Type the following command:

adb devices

If you see your device listed, it means everything is working perfectly.

Running Logcat

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.

Other useful ADB commands

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.

Hello shahz,
I’m new to this android stuff, so bear with me if I have a few questions.
1) At the Android SDK website, there are two files, one an installer and the other is not. If I use the installer file, then I can bypass step 3 above?
2) The installer says that Java SE Development Kit is not available. At the Java download site, there are 2 files available, a x32 & x64 bit version. I’m running Windows 7 x64 bit. Should I install both or just the x64 version?
Thanks in advance.

Good day! This is my first comment here so I just wanted
to give a quick shout out and tell you I really enjoy reading
through your articles. Can you suggest any other blogs/websites/forums that deal with the same topics?
Thanks a ton!

Today, its coming has been officially announced. The Padfone is what the name says – a padfone. Interesting enough, its a combination of a phone and a tablet and you can use the tablet to charge the phone as well. A rather innovative product joining the mobile line of the ASUS arsenal. I’m looking forward to the device just for More...

So we had confirmed sources saying there will be no Froyo on the A10. I wasn’t really surprised when I was told about that and I didn’t have any problems with not having Froyo upgrade. Several reasons that I would like to specify:
OS upgrades are never ending
When the A10 first came out, it came with the 1.6 Cupcake. More...

Almost two years ago, the first Android phone came to the scene. I was kinda excited back then because I was already following its verdicts before it was even released. My first Android phone was the HTC Hero (which was lost when it was being shipped to SIS for warranty repair). I was reminiscing my experience with Android throughout this More...

I am pretty sure you guys have read about the recent virus outbreak on Android. If you haven’t, well, there has been one (again) yesterday. Codenamed “Gemini”, its one of the most sophisticated Android malware on earth so far. It has capabilities of sending your personal data to a remote server. To make things worse, its also said that the More...

When I first bought the Nexus One, my intentions were to get a powerful phone that fulfills all my requirements. 1GHz Snapdragon sounded yummy. And as the features list went on, I already knew I was going to get it before it was even launched – which drove me to the point of buying the phone on the first day More...