Friday, August 6, 2010
Attaching sources to the Android SDK JAR in Eclipse
An annoying thing about Android development is that you can't easily penetrate down inside Android library code because of an inexplicably misguided decision by Google engineers who've all but disallowed it. I'll stop editorializing there because I'm trying to be kinder and gentler.
In the land of Eclipse, as long as you have the source, you can easily attach it (refer to it) from the IDE in such a way as to a) Ctrl-click an identifier to jump to its implementation or b) step down into it when running in debug mode.
I spent the greater part of today researching this problem. Much has been written about it, mostly bitter (and justifiable) complaining, but some have tackled the problem and tried to solve it. Maybe the solutions I read worked back a couple of years ago when they were inked on the Internet, but you could not prove it by my own experience following them.
I also found a lot of solutions required somewhat non-standard tools on your utility belt like git, Python and other stuff you might not ordinarily associate with Eclipse use and Java development. I'm no wimp, but my productive hours aren't ones I'll willingly spend on planet Geeky Prime just to show off my technical manhood.
In the end, I solved it (probably again 'cause I'm surely not the first) with help from a more recent website that graciously posts the source code in almost exactly the form I need it for association with Eclipse.
Pursuant to my great frustration and deep-seated desire for no one else to have to rack their brains over this, I've detailed it in my article on Android development on my Hot Chocolate site. See here.
I hope this solution saves more than one person a lot of time.