ADB installation and how to logcat

ADB installation and how to logcatOne 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)

Adding Variables

Windows

A. Using Command Prompt (cmd)

  1. Hit the “Start” button. Select “Run..” then type “cmd” or just type “cmd” if you are using beyond Win XP.
  2. 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

  1. Right click on My Computer
  2. Select Properties
  3. Select the Advanced Options tab
  4. Click the Environment Variables
  5. Click the edit button of the path
  6. 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.

  • adb push <local path> <destination path>  -  Pushing files to the phone from computer. eg: adb push C:\Desktop\file.zip /sdcard/file.zip
  • adb pull <remote path> <destination path>  -  Pulling files from the phone to the computer. eg: adb pull /sdcard/file.zip C:\Desktop\file.zip
  • adb shell  -  Provides shell access to the phone. Very useful to execute root commands.
  • adb install <APK path>  -  Install applications from your computer. eg: adb install C:\Desktop\app.apk

Questions? Suggestions? Appreciation? Feel free to comment.

Shahz

Print
  1. Anwar
    #1 written by Anwar  (3 years ago)

    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.

  2. Splaktar
    #2 written by Splaktar  (2 years ago)

    1) You’ll have to try that yourself.
    2) Pick one. The 32bit version should give you less problems with configuration of the SDK.

  3. bignate78
    #3 written by bignate78  (2 years ago)

    after typing in command “adb logcat > logcat.txt” nothing happens and the command window is unresponsive.

    • ShahZ
      #4 written by ShahZ  (2 years ago)

      Did you enable the USB Debugging and install the necessary drivers?

  4. huong dan hack dragon city tren facebook
    #5 written by huong dan hack dragon city tren facebook (3 months ago)

    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!

    Check out my web page … huong dan hack dragon city tren facebook

  5. game cheats for pc
    #6 written by game cheats for pc (2 months ago)

    Thanks for sharing your thoughts about android debugging bridge.

    Regards

  6. clash of clans hack unlimited gems hack 2014

    What’s up i am kavin, its my first time to commenting anyplace,
    when i read this article i thought i could also create comment due to this
    brilliant piece of writing.

    Also visit my web blog: clash of clans hack unlimited gems hack 2014

  7. hungry shark evolution hack tool
    #8 written by hungry shark evolution hack tool (1 month ago)

    Thanks to my father who stated to me on the topic of this website, this web site is genuinely remarkable.

  8. Www.Dailymotion.Com
    #9 written by Www.Dailymotion.Com  (1 month ago)

    Hi, I do believe this is a great site. I stumbledupon it ;) I may return once
    again since I book-marked it. Money and freedom is the
    best way to change, may you be rich and continue to help others.

    Here is my blog Stone Of Life Ex Cheats (http://Www.Dailymotion.Com)

  9. You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

  10. Comment Feed for this Post
Go to Top