Eclipse的开放对异常错误的源文件 [英] Eclipse opens wrong source file on exception

查看:213
本文介绍了Eclipse的开放对异常错误的源文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有几款Android项目在Eclipse工作区:

I have several Android projects in an Eclipse workspace:


  • 一类独立的应用程序项目 my.package.Foo

  • 库项目用的不同的的类 my.package.Foo

  • 依赖于该库项目,并包含两个应用项目没有源$ C ​​$ C

与建库项目顶部的应用程序之一时,问题就来。当它崩溃(可悲的是,经常发生),我一行在logcat中的堆栈跟踪双击去相关来源。问题是,如果该行是 Foo.java 时,Eclipse始终打开从独立的项目源。我可以直接Eclipse来正确源的唯一方法是关闭独立项目,这是有点不方便。

The problem comes when working with one of the applications built on top of the library project. When it crashes (sadly, a frequent occurrence), I double-click on a line of the stack trace in the logcat to go to the relevant source. The problem is, if the line is for Foo.java, Eclipse always opens the source from the stand-alone project. The only way I can direct Eclipse to the right source is to close the stand-alone project, which is somewhat inconvenient.

有没有什么办法让Eclipse来注意哪些应用程序实际上崩溃时,它会寻找相关的源文件?我认为这是某种类路径问题的(类似于在<一个描述href=\"http://stackoverflow.com/questions/8823022/eclipse-opens-different-source-file-than-the-editable-one\">this帖子)。不过,我不认为在Android运行的配置属性的任何修改类路径。月食似乎总是通过名称的字母顺序工作区项目运行并打开第一个我/包/ Foo.java 它找到。

Is there any way to get Eclipse to pay attention to which application actually crashed when it looks for the relevant source file? I assume that this is some sort of classpath problem (similar to that described in this post). However, I don't see anything in the Android run configuration properties for modifying the class path. Eclipse always seems to run through the workspace projects in alphabetical order by name and opens the first my/package/Foo.java it finds.

我使用的是最新的Andr​​oid ADT和SDK版本。

I'm using the latest Android ADT and SDK versions.

推荐答案

每通过@blessenm注释中提供的链接,这是在Eclipse中logcat中的一个问题。我们应该看到的SDK工具发布20修复。可以看出这里,能解决它的补丁已经完成,在网上进行最终审批。

Per the link provided in the comment by @blessenm, this is an issue with logcat in Eclipse. We should see a fix in Release 20 of the SDK tools. As can be seen here, the patch that fixes it has been completed and is in line for final approval.

同时,做的最好的事情就是改变logcat的preferences(窗口 - > preferences - > Android的 - > LogCat中),这样双击动作去问题(方法声明) 而不是默认的去问题(误差线)。这不是万无一失:它至少会打开该文件,但如果有多个方法具有相同的名称,它会去的第一个方法,无论签名。 (当修复被合并,就没有必要为双击操作选项,它应该从preferences消失。)

Meanwhile, the best thing to do is to change the logcat preferences (Window -> Preferences -> Android -> LogCat) so that the double-click action is "Go to Problem (method declaration)" instead of the default "Go to Problem (error line)". This isn't foolproof: it will at least open the file but if there are multiple methods with the same name, it will go to the first method, regardless of signature. (When the fix is incorporated, there will be no need for options for double-click action and it should disappear from the preferences.)

这篇关于Eclipse的开放对异常错误的源文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆