How do I see the crash information in eclipse? Use a demo to teach you

Source: Internet
Author: User

I believe many Android beginners use the Eclipse development tools that are just beginning, and a lot of junior books will not teach you how to look at the crash log, although it is not difficult, but on their own thinking is quite a waste of time, we wrote a Demo to see it!

Comment out a line of code and let the program crash

Comment out The code that created the Viewholder object, and let the program crash.

Show a ListView in Mainactivity

This Demo is very simple, it is to show a ListViewin the mainactivity , "The first line of code" in the example.
Now we have commented out the code to create the Viewholder object, connect the phone, run the program, and look at the crash message!

Crash information

Look at the black arrow in the picture, the arrow on the left points to your package name filter , which means that only the logcatof my app is shown, and the right arrow filters the level of information to the error level.

This time we go further to narrow down the range:

Information in a black box

    • Java.lang.xxxException, this indicates your error type, if you have not seen it, use the search tool, you can understand, in our example is a null pointer exception.
    • The second black box is our own application of the package name ( page a problem), stating that this error is caused by our own code, double-click can go into the Java code, the back of those Android.widget the beginning of the crash information is some implicated information, but also can provide reference.
    • Double-click to enter 31 rows

      This line reported a null pointer exception, analysis, stating that our Viewholder did not create the object.

      Write in the back:

      In fact, the error in this example is not complicated, see the error log is also an experience live. Encounter crashes to clarify the clue, looking for the wrong position, analysis of the possible causes, see more, will slowly look.


      Original from: Jane book/melodev

How do I see the crash information in eclipse? Use a demo to teach you

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.