Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Stetho: New Android Debugging Platform (Droidcon MTL 2015)

Stetho: New Android Debugging Platform (Droidcon MTL 2015)

Stetho is a powerful debug bridge that connects the popular Chrome DevTools UI to native Android apps. With a few lines of simple initialization code most users are up and running with network traffic visualizations, a SQLite console, and SharedPreferences support. We'll also be looking at a brand new feature still in the works which will let developers inspect and manipulate the View hierarchy from within the DevTools UI.

To help developers get started, we'll talk through common integration issues and how to go beyond the DevTools UI with the dumpapp tool.

(Video to be uploaded soon)

Josh Guilfoyle

April 10, 2015
Tweet

Other Decks in Programming

Transcript

  1. Stetho Stetho New Android debugging platform New Android debugging platform

    https://github.com/facebook/stetho Josh Guilfoyle @devjasta Austin Longino @longinoa
  2. public class MyDebugApplication extends MyApplication { @Override public void onCreate()

    { Stetho.initialize( Stetho.newInitializerBuilder(context) .enableDumpapp( Stetho.defaultDumperPluginsProvider(context)) .enableWebKitInspector( Stetho.defaultInspectorModulesProvider(context)) .build()); } } Initialization
  3. Known to work with: * - Some assembly required. Picasso,

    Fresco, Glide, ... Retrofit Ion okhttp HttpURLConnection* AndroidAsync HttpClient* Volley
  4. HttpURLConnection stethoMgr = new StethoURLConnectionManager(requestName); conn = url.openConnection(); stethoMgr.preConnect(conn, ...);

    try { conn.connect(); stethoMgr.postConnect(); } catch (IOException e) { stethoMgr.httpExchangedFailed(e); throw e; } InputStream response = stethoMgr.interpretResponseStream( conn.getInputStream()); // read response...
  5. ▪ Adds ~60KB to an APK ▪ Initializes in ~1ms

    ▪ Safe in release builds, but not required Overhead