简体   繁体   English

如何调试Android应用程序

[英]How to debug an android application

Over the course of this project so far i've gotten used to looking at the logcat to tell me where the problem is when my app crashes, but my current problem doesn't crash the app it just does something it shouldn't and i can't find the code that's casuing the problem. 到目前为止,在这个项目的整个过程中,我已经习惯查看logcat来告诉我应用程序崩溃时问题出在哪里,但是我当前的问题并未使应用程序崩溃,它只是做了它不应该做的事情,我找不到导致问题的代码。

I've tried to debug before and go through the code line by line to see what causes it but for this android app it wont work. 我尝试过调试,然后逐行浏览代码以查看是什么原因导致的,但是对于此android应用程序,它将无法正常工作。 These are the steps i have taken. 这些是我采取的步骤。

  1. added debuggable = true to the manifest inside the opening application tag. 在打开的应用程序标签内的清单中添加了debuggable = true。

  2. added a line breakpoint on the line i wish the app to stop debugging on. 我希望应用程序停止调试在该行上添加了一个断点。

  3. I switch to debug perspective in eclipse and start debugging the application 我在Eclipse中切换到调试透视图,然后开始调试应用程序

It seems to just stop when the console says this: Attempting to connect debugger to 'w1279057.CW1' on port 8688 当控制台显示以下内容时,它似乎只是停止了:尝试将调试器连接到端口8688上的“ w1279057.CW1”

Have i done something wrong? 我做错了什么吗?

如果您使用的是Eclipse,则http://www.vogella.de/articles/EclipseDebugging/article.html并使用LogCat

If you are triying to debug on a real phone you need to enable USB debugging in the settings. 如果您想在真实电话上调试,则需要在设置中启用USB调试。 It is explained here: http://www.groovypost.com/howto/mobile/how-to-enable-usb-debugging-android-phone/ 此处说明: http//www.groovypost.com/howto/mobile/how-to-enable-usb-debugging-android-phone/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM