收藏    我在用   0 人在用

Facebook 出品的一个强大的 Android 调试工具,使用该工具你可以在 Chrome Developer Tools查看App的布局, 网络请求(仅限使用Volley, okhttp的网络请求库), sqlite, preference, 一切都是可视化的操作,无须自己在去使用adb, 也不需要root你的设备

 GitHub     官网     下载     同步

397    10533    964    over 1 year前

Stetho Build Status

Stetho is a sophisticated debug bridge for Android applications. When enabled,
developers have access to the Chrome Developer Tools feature natively part of
the Chrome desktop browser. Developers can also choose to enable the optional
dumpapp tool which offers a powerful command-line interface to application

Once you complete the set-up instructions below, just start your app and point
your laptop browser to chrome://inspect. Click the "Inspect" button to



Download the latest JARs or grab via Gradle:

compile 'com.facebook.stetho:stetho:1.4.2'

or Maven:


Only the main stetho dependency is strictly required; however, you may also wish to use one of the network helpers:

compile 'com.facebook.stetho:stetho-okhttp3:1.4.2'


compile 'com.facebook.stetho:stetho-urlconnection:1.4.2'

You can also enable a JavaScript console with:

compile 'com.facebook.stetho:stetho-js-rhino:1.4.2'

For more details on how to customize the JavaScript runtime see stetho-js-rhino.

Putting it together

Integrating with Stetho is intended to be seamless and straightforward for
most existing Android applications. There is a simple initialization step
which occurs in your Application class:

public class MyApplication extends Application {
  public void onCreate() {

This brings up most of the default configuration but does not enable some
additional hooks (most notably, network inspection). See below for specific
details on individual subsystems.

Enable network inspection

If you are using the popular OkHttp
library at the 3.x release, you can use the
Interceptors system to
automatically hook into your existing stack. This is currently the simplest
and most straightforward way to enable network inspection:

new OkHttpClient.Builder()
    .addNetworkInterceptor(new StethoInterceptor())

Note that okhttp 2.x will work as well, but with slightly different syntax and you must use the stetho-okhttp artifact (not stetho-okhttp3).

As interceptors can modify the request and response, add the Stetho interceptor after all others to get an accurate view of the network traffic.

If you are using HttpURLConnection, you can use StethoURLConnectionManager
to assist with integration though you should be aware that there are some
caveats with this approach. In particular, you must explicitly add
Accept-Encoding: gzip to the request headers and manually handle compressed
responses in order for Stetho to report compressed payload sizes.

See the stetho-sample project for more details.

Going further

Custom dumpapp plugins

Custom plugins are the preferred means of extending the dumpapp system and
can be added easily during configuration. Simply replace your configuration
step as such:

    .enableDumpapp(new DumperPluginsProvider() {
      public Iterable<DumperPlugin> get() {
        return new Stetho.DefaultDumperPluginsBuilder(context)
            .provide(new MyDumperPlugin())

See the stetho-sample project for more details.

Improve Stetho!

See the file for how to help out.


Stetho is BSD-licensed. We also provide an additional patent grant.

No Reply at the moment.
需要 Sign In 后方可回复, 如果你还没有账号请点击这里 Sign Up