When you are developing an Android application with the Eclipse plugin and debugger, and get a stack trace, you will not see any of the SDK source code. What steps do you need to make to fix this? Assume beginner Java programmer.
To clarify, I want Eclipse to automatically show me the correct source files and lines when I jump into a stack frame. I assume I would need to find the correct SDK sources, put them on my local system and then tell Eclipse how to find and use them. The question is, how exactly do I do these steps.
Thanks to lukehutch on #android IRC channel I got pointed to a blog post that describes how to fix the problem.
The reason why this is even a problem is because Google did not include the sources with the SDK. There is a bug to get this fixed.
The workaround, as described in more detail in the blog post, is to get the sources with git (I specified release-1.0 branch for repo command which I hope corresponds with SDK 1.0-r2), collect all the java source files and put them in the correct directory structure under sources/ directory (which goes right next to your android.jar from the SDK), and refresh the jar in Eclipse at which point you can browse the SDK class sources.
Finally, run your application in the debugger until you get a stack trace from an SDK class, and you will see a button to configure your sources: add the sources directory you created.
The blog link above has a small Python script that can collect all the java files and create the correct directory structure out of them.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With