最新消息:20210917 已从crifan.com换到crifan.org

【已解决】Android开发中,用ADT调试apk时,无法单步调试Step Over,会跳转到Source Not Found

Android crifan 3062浏览 0评论

【问题】

在用ADT开发android的app,去调试app时,对于某些行的代码,去单步执行F5(Step Over)时:

debug this line code

不是Step Into,结果也会跳转到对应的Source Not Found的界面:

souce not found

 

【解决过程】

1.参考:

Android Debugging Problem

Window -> Preferences -> Java -> Debug -> Step Filtering:

window preferences

use step filters

选中所有的,即,对于这些,Java的核心的库,代码调试的时候,都不要去调试。

2.然后再去调试那行代码,看看是否还会出现这个问题。

结果问题依旧,还是Source Not Found的问题。

3.再参考上述帖子所提到的:

Debugging with step filters

去设置:

execute filter package

结果没啥反应。

重新调试,结果还是问题依旧。

4.其中,我此处相关的库是:

import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.HttpStatus;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.HttpResponse;
import org.apache.http.util.EntityUtils;
import org.apache.http.client.ClientProtocolException;

所以去试试,把org.apache.http都添加进去:

add package for http

added org apache http

重新再去调试,看看效果。

结果问题依旧。

5.再去把其他的,都添加上:

org.apache.http.client.methods

 

org.apache.http.client.methods

也试了试,没有再下一级别的:

org.apache.http.client.methods.HttpGet

org.apache.http.client.methods.HttpPost

了。

再看看效果。

结果问题依旧。

6.把所有的选择都选上了:

all para check

结果问题依旧。

 

【总结】

暂时不知道是什么原因,无法解决此Source Not Found的问题。


【后记 2012-12-19】

后来得知原因了:

当代码运行出错的时候,比如:

  • 访问网络出错
  • 运行正则,结果由于其某些语法(命名的组)不支持导致程序出错

但是此时去调试时,即使已经把对应的类,添加到了filter里面了,但是只会看到代码跳转到Source Not Found的界面,并没有看到有任何错误提示。

而如果程序本身正常,则不会跳转到Source Not Found的界面的。

 

【总结】

当出现Source Not Found的界面的时候:

  • 确保你的代码本身可以正常运行
    • 很多时候,就是代码执行异常了,才跳转到Source Not Found的界面的
  • 然后代码正确的前提下,再去把对应的类,添加到对应的filter中;

转载请注明:在路上 » 【已解决】Android开发中,用ADT调试apk时,无法单步调试Step Over,会跳转到Source Not Found

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
93 queries in 0.185 seconds, using 23.39MB memory