Android开发调试神器Stetho

随着Android开发技术的逐步完善,好用的插件,开源项目越来越多,善于使用这些插件能够大大提升你的开发效率。今天暂时介绍一个Facebook开源的Andorid调试工具,接下来几篇文章我会介绍我整理的几个Android开源项目&Studio插件,熟练使用这些插件,能够很好的提高开发效率。

那么问题来了,这么niubility的工具到底怎么集成?
分为以下四步:

1. 项目添加依赖。

   compile ‘com.facebook.stetho:stetho:1.3.1‘ compile ‘com.facebook.stetho:stetho-okhttp3:1.3.1‘
 

注:这里以Okhttp为例,并认为你已经使用了okhttp,其他网络请求工具请自行百度,或者到项目地址查看。

2. 初始化 Stetho

    public class MyApplication extends Application { public void onCreate() { super.onCreate(); //Stetho.initializeWithDefaults(this); 
        initStetho();
  }
private void initStetho() {
Stetho.initialize(
Stetho.newInitializerBuilder(this)
.enableDumpapp(Stetho.defaultDumperPluginsProvider(this))
.enableWebKitInspector(Stetho.defaultInspectorModulesProvider(this))
.build());
    }
} 

3. 修改网络请求(可选)

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

4. 运行你的项目

   在chrome中访问 chrome://inspect
   找到你的项目 点击 inspect

https://blog.csdn.net/sbsujjbcy/article/details/45420475
Android Studio 简单使用 GreenDao3.0

https://blog.csdn.net/qq_27899045/article/details/52797636

 

 


 

猜你喜欢

转载自www.cnblogs.com/liangxy/p/9030115.html