Strange restrictions on libraries in Android SDK v8

So the Android team finally get around to adding support for libraries to the ADK’s build process for froyo (2.2, or SDK v8).  Fabulous, you say - so now you can finally extract that chunk of, say, com.ctoforaday.common, rename it to something guicey like com.ctoforaday.guicedroid, and start extracting the reusable bits of guice coding you’ve been building in your application into a place others can use to start freeing themselves from the nightmare of singletons, subclassing, and oversized contexts that someone who much too much liked the word ‘discoverability’ choked on one morning and died from.

So I went and did that (splitting out the project, not choking and dying).  Even got a private github repository hosting it as a separate project, which eventually I’ll get around to open sourcing.

Here’s the gotcha:  Inevitably, someone who writes tests is going to have two implementations of a class, a real one, and for complex stuff, a fake one.

Here’s the limitation: A library can’t depend on a library.  So you either ship your mock/fakes in with your core library, and therefore straight into people’s binaries, enabling the possible mess of ending up with fakes used in production code, or you end up building the mock/fake implementations in each and every test project you create.

I don’t know what it is about testing that mobile developers just don’t seem to get.  It’s as though they assume that their time is worthless, and they’d really like to spend the rest of their lives debugging code.  Executing Android tests never gets easier, never gets faster, and actually writing android tests isn’t becoming a warmer or happier place.  It’s as though they’re just not expending any efforts to improve the testability of the product, or just assume that absolutely everything to be written for Android is either so trivial as to not require testing, or so complex that it’s “too hard” to do anything about.

Bloody frustrating.  Turns a half hour’s extraction into an entire morning of playing with Eclipse wondering why things don’t just work the way you’d imagine they would.