美文网首页Android
OkHttp Profiler plugin 使用

OkHttp Profiler plugin 使用

作者: proud2008 | 来源:发表于2020-04-21 16:00 被阅读0次

查看拦截okhttp发出的请求
1、build.gradle

implementation 'com.itkacher.okhttpprofiler:okhttpprofiler:1.0.4' 

2、添加拦截

OkHttpClient.Builder builder = new OkHttpClient.Builder();
 if (BuildConfig.DEBUG) {
    //builder.addNetworkInterceptor(new StethoInitInterceptor(context));
// 同时添加了,OkHttpProfilerInterceptor这个就看不到了
     builder.addInterceptor(new OkHttpProfilerInterceptor());
 }   
OkHttpClient client = builder.build(); 

3、android studio 安装插件

OkHttp Profiler
image.png
image.png

相关文章

网友评论

    本文标题:OkHttp Profiler plugin 使用

    本文链接:https://www.haomeiwen.com/subject/eijpphtx.html