cyli's blargh
( )
Android ApiDemos in Eclipse

Notes to myself on how to set up Android ApiDemos

Mon 27 April 2009 - Android, Testing

I've been learning how to write Android apps lately, and I've been trying to figure out to use TDD. Diego Torres Milano's blog has been pretty helpful to me, especially his post about how get Android ApiDemos' tests to work. As a newbie to Eclipse and Android development though, I had some trouble with his instructions.

Here are a few things I did that I didn't think was very clear on Diego's blog:

  • Create an ApiDemos Project first (New Android project -> Project from source -> use the source from [android SDK directory]/samples/ApiDemo).
  • Don't bother to delete the Dummy class or remove the source directory you created (when you follow his instructions to create the ApiDemosTest project).
  • The emulator has the ApiDemos installed by default. You should uninstall the default installation (adb uninstall and run your ApiDemos project in Eclipse. If you don't, you'll get errors when you run ApiDemosTest because the default ApiDemos installation is in a separate security domain (I think).

Other than these points, his post (and the comments) are pretty clear. This entry from Zhao's Weblog is also helpful.