适用于使用了 OkHttp/Retrofit 作为网络请求框架的项目,可以拦截并缓存应用内的所有 Http 请求和响应信息,且可以以 Notification 和 Activity 的形式来展示具体内容
一个适用于 OkHttp 和 Retrofit 的可视化抓包工具
只需为 OkHttpClient 添加 MonitorInterceptor,就会自动记录并缓存所有的网络请求信息,并提供可视化界面进行查看
val okHttpClient = OkHttpClient.Builder()
.addInterceptor(MonitorInterceptor())
.build()
同时引入 debug 和 release 版本的依赖库
dependencyResolutionManagement {
repositories {
google()
mavenCentral()
}
}
dependencies {
val latestVersion = "x.x.x"
debugImplementation("io.github.leavesczy:monitor:${latestVersion}")
releaseImplementation("io.github.leavesczy:monitor-no-op:${latestVersion}")
}