Reputation: 329
I am working on an Android project that depends on library written in Java. I develop the library too so I have sources of both - main project and library. I work with eclipse in standard way - both library and the main project are Android projects (no external jar in buildpath or something like that), both are open in the same workspace.
I have problem with debugging the library code. I can put a breakpoint there, the program really breaks but I do not see the source code (which is open in the next child window :-( ... ), I only see the class file editor of the correct file and Java pseudoassembler code. There is a button "Change attached source..." which looks potential but problem is that this button sometimes does not work. When I press it, I can choose "workspace..." or "external folder...", select src directory of the library and press ok, but this has no effect. There will be just a short progress dialog and no change.
Please note that sometimes "Change attached source..." works, but in general if it fails, the second (3rd, 4th, ...) will always fail to so trying it more times does not help. When "Change attached source..." takes effect, it works well for several eclipse sessions but then it fails again and repairing it by "Change attached source..." is a big lottery. Sometimes it works, sometimes not.
The problems are only with library code. The main project works always well even without explicit attached source settings.
Any idea?
"Change attached source..." button does never work. But there is (on the same place and in the same situation) sometimes other very similar button I think "Edit attached source..." (I am sure it starts with "Edit") and this button always works. It looks very wired but it really works so. It must be some bug in Eclipse or Android plugin.
Upvotes: 5
Views: 3647
Reputation: 2998
Choose External Source Click on select Folder and select your Android SDK Source Folder something like this: C:\Android\sdk\sources This will work for classes that are Android SDK Classes
Upvotes: 0
Reputation:
1- Click change the attach source
2- select external location(radio button)
3-select external folder
4-and select source folder in android sdk folder
5-Click ok.
Upvotes: 0
Reputation: 3845
I use the Eclipse bundled with the android sdk.
I followed the instructions on the following link:
http://www.mkyong.com/android/attach-android-source-code-to-eclipse-ide/ worked for me.
The instructions are precise and accurate and worked for me. Hope this works for you.
Upvotes: 0
Reputation: 1
If you work on the android project, you shall know the SDK. There is a folder named "sources"
and there are source code in it. So maybe you can press the "external folder"
and then choose that folder.
Upvotes: 0
Reputation: 329
Finally I find the solution (tested on Eclipse Version: Juno Release, Build id: 20120614-1722 and Android SDK 20.0.3). When debugger stops on breakpoint in the "unknown" source of our library, right click on the stack line and it is possible to select an extra source folder in the context menu there. I always specify workspace folder and library src dir. This works in the latest Eclipse and Android SDK/ADT.
Upvotes: 4