Slide 1

Slide 1 text

Stetho Stetho New Android debugging platform New Android debugging platform https://github.com/facebook/stetho Josh Guilfoyle @devjasta Austin Longino @longinoa

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

public class MyDebugApplication extends MyApplication { @Override public void onCreate() { Stetho.initialize( Stetho.newInitializerBuilder(context) .enableDumpapp( Stetho.defaultDumperPluginsProvider(context)) .enableWebKitInspector( Stetho.defaultInspectorModulesProvider(context)) .build()); } } Initialization

Slide 4

Slide 4 text

Initialization (cont.) OkHttpClient client = new OkHttpClient(); client.networkInterceptors().add(new StethoInterceptor());

Slide 5

Slide 5 text

Stetho In Action

Slide 6

Slide 6 text

Known to work with: * - Some assembly required. Picasso, Fresco, Glide, ... Retrofit Ion okhttp HttpURLConnection* AndroidAsync HttpClient* Volley

Slide 7

Slide 7 text

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...

Slide 8

Slide 8 text

▪ Adds ~60KB to an APK ▪ Initializes in ~1ms ▪ Safe in release builds, but not required Overhead

Slide 9

Slide 9 text

Debug only builds dependencies { debugCompile 'com.facebook.stetho:stetho:1.1.0' compile 'com.facebook.stetho:stetho-urlconnection:1.1.0' // or debugCompile '...stetho-okhttp...' }

Slide 10

Slide 10 text

Debug only builds (cont.)

Slide 11

Slide 11 text

Now the fun stuf

Slide 12

Slide 12 text

dumpapp ▪ Think many main(String[]) methods ▪ Built like a true CLI ▪ Simplicity as a feature

Slide 13

Slide 13 text

Example: crash $ dumpapp crash kill $ dumpapp crash throw

Slide 14

Slide 14 text

Example: hprof $ ./scripts/hprof_gen.sh

Slide 15

Slide 15 text

Example: custom plugin

Slide 16

Slide 16 text

Q & A https://github.com/facebook/stetho Josh Guilfoyle @devjasta Austin Longino @longinoa