At some point or another, most Android developers will eventually open up the profiling tools to track down bugs and performance issues in a misbehaving application. Let's be honest, the tools included with the Android SDK do leave something to be desired. Facebook has just released one of its internally-developed tools which provides network inspection, database inspection and interaction, and a support for access to the dumpapp output with the use of customizable plugins. The most interesting feature about Stetho is that it runs entirely through the Chrome Developer Tools – the same interface used by web developers everywhere.


Network Inspector

Keep in mind, Stetho is not a total debugger replacement. Not yet, at least. Things like CPU and memory profiling, stepping through code line-by-line, and an execution timeline aren't currently a part of this tool.

Stetho does offer a couple of handy alternatives to the standard profilers. The first is a network inspector capable of offering image previews, JSON response helpers, and loading timelines. This helps developers find inefficiencies in their apps while pulling data from the Internet, just like they would with any web application. The other major feature is an interactive database front-end with the ability to read and write values to SQLite databases located in an app's private storage.


Interactive Database Editor

Extensibility is also possible through use of a plugin system called dumpapp. This mini-framework allows developers to create handy scripts that can be called from the command line and executed from within the app during runtime. There is currently one sample plugin that can read and write key-value pairs to Shared Preference files in an app's private folder. A toolbox of custom plugins combined with a few shell scripts would make this a powerful way to automate a number of activities in the app, particularly for reproducing a bug.

Facebook's announcement makes it clear that this is still a fairly early release, and as such, there are many more features to come, and probably quite a few bugs to work out. Even the wording in the documentation implies that there is a "default set of plugins" (note plurality), which hints that there are probably a few more in the works. Of course, more inspectors and possibly a few other tricks should be coming, as well. If we're to look at some of Facebook's similar projects, the developers are likely to make pretty regular updates and continually evolve the codebase on a systematic basis.

Facebook released Stetho under the BSD open source license. If you're interested in trying it out for yourself, check out the Integration instructions. For more details, check out the Facebook blog, Stetho documentation, and Github Code Repository. All three pages contain very similar information, but each one is slightly different, and there are a few useful details unique to each one.