Debug the android program using myeclipse-use logcat to debug the program

Source: Internet
Author: User
Many users who are new to Android development may encounter debugging problems. How can they quickly find the "Accident location" based on the error prompt "? In the eclipse + ADT development environment, there is no good way to directly track object content. By using the Android. util. Log class, you can find errors and print system log messages by yourself. It is an API for log output.ProgramYou can insert a log for an object at any time, and then observe whether the output of logcat is normal in ddms. Common android. util. Log methods include log. V () log. D () log. I () log. W () and log. E (). Corresponds to verbose, debug, info, warn, and error according to the first letter.

Example: log. E ("ex12", "what is the problem ");

This is a static method. Both parameters are string-type. The first is to give a Tage to mark the location of your output information. The second is the information you want to output.

The following describes how to conveniently view logcat content in myeclipse:

Window> customize perspective> shortcuts>

Submenus: Show View> categories: Android> check logcat.

Then, logcat is displayed by WINDOW> show View> logcat.

You can also click ">" in the upper right corner and select "ddms" to view the logcat

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.