Commit 079c5d473a18b132b52fac1385b5f4a28d14ec43
1 parent
3c7e91f31a
Exists in
master
修改开发环境, 添加chucker抓包
Showing
3 changed files
with
11 additions
and
1 deletions
Show diff stats
build.gradle
libs/common/build.gradle
... | ... | @@ -50,5 +50,13 @@ dependencies { |
50 | 50 | |
51 | 51 | support.each { k, v -> implementation v } |
52 | 52 | |
53 | + // 抓包, OkHttp拦截 | |
54 | + def chuckerVersion = "3.5.2" | |
55 | + debugImplementation("com.github.chuckerteam.chucker:library:$chuckerVersion") { | |
56 | + exclude module: 'lifecycle-viewmodel-ktx' | |
57 | + } | |
58 | + releaseImplementation("com.github.chuckerteam.chucker:library-no-op:$chuckerVersion") { | |
59 | + exclude module: 'lifecycle-viewmodel-ktx' | |
60 | + } | |
53 | 61 | |
54 | 62 | } |
55 | 63 | \ No newline at end of file | ... | ... |
libs/common/src/main/java/com/prws/common/net/OkHttp3Utils.java
... | ... | @@ -6,6 +6,7 @@ import android.net.NetworkInfo; |
6 | 6 | import android.util.Log; |
7 | 7 | |
8 | 8 | |
9 | +import com.chuckerteam.chucker.api.ChuckerInterceptor; | |
9 | 10 | import com.prws.common.CommonApplication; |
10 | 11 | |
11 | 12 | import java.io.File; |
... | ... | @@ -49,6 +50,7 @@ public class OkHttp3Utils { |
49 | 50 | //设置一个自动管理cookies的管理器 |
50 | 51 | .cookieJar(new CookiesManager()) |
51 | 52 | .cache(cache) |
53 | + .addInterceptor(new ChuckerInterceptor.Builder(CommonApplication.getAppContext()).build()) | |
52 | 54 | .addInterceptor(new SignInterceptor()) |
53 | 55 | //添加拦截器 |
54 | 56 | .addInterceptor(new MyIntercepter()) | ... | ... |