Android: The program is unresponsive, how do you locate the problem?

Source: Internet
Author: User

If the mainthread is unresponsive for a long time, the system will prompt "XXX unresponsive" and the user will be closed. So, how to locate the problem? No response is not like crash, it does not fetch the exception log, usually we need to debug in order to locate the problem. How to debug it?

1. In the Eclipse Devices window, select the package name for the app, then click the Debug icon (green bug) and switch to debug view


2. After switching the view, you can see the thread list of the app under Debug.




3. For the main thread (the first thread), select and suspend it suspend


4. Then we can see, after suspend, where the main thread is stuck:


As can be seen, when the main thread calls Pausebubbleandhide, Surfaceview cannot lockcanvas cause the page to get stuck. After the follow-up investigation found that before the use of this method, Lockcanvas and Unlockcanvasandpost did not appear in pairs, after the last lock, there is no unlock, according to Lockcanvas again, unable to respond. Then solve the problem.

The above describes the steps that the debugger does not respond to.

-------------------------------------------------------------------

more communication, Android Development Alliance QQ Group: 272209595




Android: The program is unresponsive, how do you locate the problem?

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.