Unable to Debug Library Projects with ADT v14 - So

2019-03-14 08:13发布

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.

7条回答
地球回转人心会变
2楼-- · 2019-03-14 08:14

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 :)

查看更多
趁早两清
3楼-- · 2019-03-14 08:16

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)

查看更多
闹够了就滚
4楼-- · 2019-03-14 08:18

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

查看更多
Evening l夕情丶
5楼-- · 2019-03-14 08:29

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.

查看更多
太酷不给撩
6楼-- · 2019-03-14 08:36

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.

Good luck.

查看更多
Viruses.
7楼-- · 2019-03-14 08:39

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.

I hope this is helpful to you and anyone else experiencing this annoying issue. :)

Thanks, Ed

查看更多
登录 后发表回答