android网络调试工具Stetho介绍
来源:互联网 发布:咫尺网络微官网 编辑:程序博客网 时间:2024/06/05 23:39
背景
以前我们在开发过程中一直使用的是vpn代理抓包的方法,来处理后端哥们在调试过程中的数据问题,但前段时间公司网络调整,代理不能用了,很是莫名奇妙。。。。没办法,只能另辟蹊径,在网上查找发现还真有一款很不错的工具,那就是我今天给大家介绍的工具Stetho,这是有facebook出品的一款开源工具,源码https://github.com/facebook/stetho,很好,很强大,跟web的浏览器开发工具差不多,本篇主要讲如何接入
使用前提
要翻墙,要翻墙,要翻墙,重要的事说三遍,不然当你打开chrome的时候就会发现一片空白(具体方法下面讲),这点很坑。
接入Stetho
第一步:
grade接入
compile 'com.facebook.stetho:stetho:1.5.0'
compile ‘com.facebook.stetho:stetho:1.5.0’
Maven接入
<dependency> <groupId>com.facebook.stetho</groupId> <artifactId>stetho</artifactId> <version>1.5.0</version></dependency>
第二步
使用okhttp作为网络请求的基础库
compile 'com.facebook.stetho:stetho-okhttp3:1.5.0'
第三步 初始化 Stetho
在Application中加入
public class MyApplication extends Application { public void onCreate() { super.onCreate(); Stetho.initializeWithDefaults(this); }}
使用okhttp3.x
new OkHttpClient.Builder() .addNetworkInterceptor(new StethoInterceptor()) .build()
使用okhttp2.x
OkHttpClient client = new OkHttpClient();client.networkInterceptors().add(new StethoInterceptor());
最后chrome联调
连接数据线,注意必须连接数据线,启动你的程序,在chrome上输入chrome://inspect,你就会得到一片空白,如下图:
在点击inspect进入调试界面,记住一定要翻墙,不然你就会得到如下的界面:
阅读全文
0 0
- android网络调试工具Stetho介绍
- facebook的Android调试工具Stetho介绍
- facebook的Android调试工具Stetho介绍
- facebook的Android调试工具Stetho介绍
- facebook的Android调试工具Stetho介绍
- facebook的Android调试工具Stetho介绍
- android 调试工具之facebook stetho介绍
- Android调试工具Stetho
- facebook的Android调试工具Stetho介绍和使用注意事项
- Android调试工具_ Stetho
- Android必知必会-Stetho调试工具
- facebook stetho Android调试工具
- Android 调试工具 Stetho 使用学习
- Android 强大的调试工具 Stetho
- Facebook的Android调试工具Stetho
- Android 调试模式工具的Stetho
- OkHttp+Stetho+Chrome调试android网络部分
- OkHttp+Stetho+Chrome调试android网络访问
- Spring MVC重定向参数传递
- Lua语法小贴士(十六)pairs和next
- SQL数据库安装
- C++多态的概念以及用途
- ubuntu for AM5728
- android网络调试工具Stetho介绍
- 短实习---Java面向对象(练习题)
- 51nod 1289 大鱼吃小鱼
- 仿中国比特币首页趋势图,折线图,k线图
- HDU
- BZOJ 4540: [Hnoi2016]序列 莫队算法
- iOS支持富文本Label控件
- android 跑马灯出现重复跳动、不滚动问题
- Spring Boot --微信企业号开发01-使用新花生壳进行本地开发测试