无法使用 ADT v14 调试库项目 - 未找到源

发布于 2024-12-12 03:08:54 字数 273 浏览 0 评论 0原文

自从升级我当前的项目以使用 Eclipse 中的新 R14 工具以来,我现在无法调试我的库项目中存在的任何代码。

当我在库项目代码中遇到断点时,Eclipse 不会打开原始源文件,而是打开 JAR 中包含的源文件的只读副本,并显示消息“未找到源”。

我已经四处寻找解决方案,但尚未遇到任何问题。还有其他人有什么建议吗?无法调试真是一件痛苦的事。

编辑

问题又出现了,我无法再进行调试。我没有更改任何项目设置或任何内容。非常令人沮丧。

Ever since upgrading my current projects to use the new R14 Tools in Eclipse, I'm now unable to debug any code that exists in my library projects.

When I hit a break point in my library project code, instead of Eclipse opening the original source file, it opens up the read-only copy of the source file contained within the JAR with the message "Source not found".

I've searched around for a solution to this, but have yet to come across anything. Does anybody else have any suggestions? It's quite a pain not being able to debug.

EDIT

The issue has came back and I'm no longer able to debug. I haven't changed any project settings around or anything. Very frustrating.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

青瓷清茶倾城歌 2024-12-19 03:08:54

尝试了上述所有方法,但它对我不起作用,但是这里详细介绍的解决方法却有效。

http://code.google.com/p/android/issues/detail ?id=20731

  1. 开始调试,并运行直到遇到断点(并精确地获取 .class 文件,而不是您想要的 .java)
  2. 右键单击“调试”透视图的“调试”视图(例如在调用堆栈上),然后选择“编辑源查找路径”
  3. 通过“添加...”将所有项目添加到“默认”上方 > “Java项目”> “全选”

(我正在使用 http://tools.android.com/download< 中的 ADT 15.0.2 预览版/a>)

Tried all of the above and it did not work for me, however the workaround detailed here did.

http://code.google.com/p/android/issues/detail?id=20731

  1. Start debugging, and run until you hit a breakpoint (and precisely get a .class file instead of the .java you would like to have)
  2. Right click in the Debug view of the Debug perspective (for example on the call stack), and choose "Edit Source Lookup Path"
  3. Add all your projects above "Default", via "Add..." > "Java project" > "Select All"

(I'm using ADT 15.0.2 preview from http://tools.android.com/download)

清君侧 2024-12-19 03:08:54

在遇到这个问题并做了一些研究之后,我发现了这个线程和另一个给我提示的线程。我已经把头发拉出来了。

事实证明,问题出在您的项目的构建顺序上(无论如何我的项目都是如此)。由于 ADT/SDK v14 改变了库项目的引用方式,因此构建顺序需要正确。确保首先构建您的应用程序使用的所有库。我刚刚将每个项目的“src”和“gen”文件夹移动到底部,现在它首先构建库,我可以调试它并通过主项目查看库文件的源代码。

如果有人不知道在哪里执行此操作,请在 Eclipse 中右键单击您的项目和“构建路径”,然后单击“配置构建路径”。然后,在“订购和导出”选项卡上,将项目的两个文件夹移动到库下方列表的底部。我为我的所有项目和图书馆项目都这样做了。

您还可以在 Eclipse 中从 Windows->Preferences->General->Workspace->Build Order 进行全局操作,并将库项目移动到顶部。我认为每个项目中定义的构建顺序都会覆盖这一点,因此您可能希望在两个地方都这样做,以解决现在和未来项目的问题。

After having this issue as well and doing a little research, I came across this thread and another one that tipped me off. I was pulling my hair out already.

It turns out that the problem is with the build order of your projects (mine was anyway). Since ADT/SDK v14 changed the way library projects are referenced, the build order needs to be correct. Make sure all of the libraries your app uses are built first. I just moved the "src" and "gen" folders for each of my projects to the bottom and now it builds the library first and I am able to debug it and view the source of my library files through the main project.

In case someone doesn't know where to do this, in Eclipse, right click on your project and "Build Path" and then click "Configure Build Path". Then, on the "Order and Export" tab, move the two folders for your project to the bottom of the list below your libraries. I did this for all of my projects and the library projects.

You can also do it globally in Eclipse from Windows->Preferences->General->Workspace->Build Order and moving your library projects to the top. I think the build order defined in each project will override this though, so you may want to do it in both places to solve the issue now and for future projects.

随心而道 2024-12-19 03:08:54

我今天在一个项目中遇到了同样的问题。该项目由一个具有两个库依赖项的应用程序组成。我在调试期间看不到代码,并且在覆盖方法时使用自动完成功能时,Eclipse 无法推断出正确的参数名称。

首先,问题通过显示“gen”文件夹被用作包含源代码的文件夹来表现出来。要检查这是否是同一问题,请转到您的应用程序项目,打开 Android 依赖项并查看库依赖项的属性。位置路径表示/libraryprojectname/gen。

如果这也是您的问题,请转到每个库项目的“订购和导出”选项卡,并将“gen”项目移到“src”项目下方。一旦您单击“确定”,Eclipse 就会开始工作,当您检查 Android 依赖属性时,位置路径应为:/libraryprojectname/src。打开单击依赖项并打开 jar 内的任何类。它应该显示来源。

我将 ADT 插件 20.0.3 与 Android SDK Tools 20.0.3 和 Android SDK Platform Tools 14 一起使用。

I had the same problem in a project today. The project consists of an app which has two library dependencies. I could not see code during debugging and when using auto-completion when overriding methods Eclipse was unable to deduce proper argument names.

First of all, the problem manifested itself by showing the the 'gen' folder was used as the one that contained the source. To check whether this is the same issue go to your app project, open the Android dependencies and have a look at the properties of the your library dependencies. Location path said /libraryprojectname/gen.

If this is also your problem then go to the 'Order and Export' tab of each library project and move the 'gen' item below the 'src' item. As soon as you click OK Eclipse will work a bit and when you check the Android dependency properties the location path should say: /libraryprojectname/src. Open click the dependency and open any class inside the jar. It should show the source.

I am using ADT plugin 20.0.3 with Android SDK Tools 20.0.3 and Android SDK Platform Tools 14.

涙—继续流 2024-12-19 03:08:54

以下内容在 Eclipse Juno 上对我有用:

在项目属性/Java 构建路径中:

  • 在“项目”选项卡中,添加我的库项目。
  • 在“Order and Export”选项卡中,将我的库项目移动到顶部,并检查它们

不确定是否相关,但Android SDK工具是rev 20.0.3,Android SDK平台工具是14。

The following worked for me on Eclipse Juno:

In Project Properties/Java Build Path:

  • In the Projects tab, added my library projects.
  • In the Order and Export tab, moved my library projects to the top, and checked them

Not sure if it's relevant, but Android SDK tools is rev 20.0.3 and Android SDK platform tools is 14.

夜深人未静 2024-12-19 03:08:54

我假设您正在打开图书馆项目,并在那里放置了刹车点。
试试这个:在主项目上,从 Package Explorer 打开 Library Projects->[yourlibrary.jar]->[yourfile.class],然后在 .class 文件中放置制动点。
这至少对我有用:)

I assume you are opeining library project and there you put brakepoint.
Try this: On main project open Library Projects->[yourlibrary.jar]->[yourfile.class] from Package Explorer, and then in .class file put brakepoints.
This works for me at least :)

琉璃繁缕 2024-12-19 03:08:54

有时这种情况发生在我身上。不确定原因,但我解决的方法是:

从 eclipse 中删除主项目。 -- 关闭Eclipse -- 删除库项目中的jar文件 -- 打开Eclipse -- 等待库项目编译 -- 导入主项目

Sometimes this happens to me. Not sure about the reason but the way I solve is:

Remove the main project from eclipse. -- Closs Eclipse -- Delete the jar file in the library project -- Open Eclipse -- Wait for the library project to compile -- Import the main project

甜味拾荒者 2024-12-19 03:08:54

Juno 内的 ADT 版本 21 也会出现此问题。作为解决方法,在调试透视图的“调试”视图中(您可以在其中看到线程和方法调用跟踪),右键单击并编辑源查找路径。

This problem also occurs with release 21 of ADT inside Juno. As a workaround, in the "debug" view of the debug perspective (where you see threads and method invocation traces), right click and edit source lookup path.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文