【发布时间】:2020-06-29 15:22:26
【问题描述】:
拥有 android 库模块,在调试版本中它想在发布版本中使用 stetho,bot no。 我猜它可能会增加对
的依赖debugCompile 'com.facebook.stetho:stetho:1.4.1'
debugCompile 'com.uphyca:stetho_realm:2.0.0'
or using
debugImplementation 'com.facebook.stetho:stetho:1.4.1'. // with latest version
debugImplementation 'com.uphyca:stetho_realm:2.0.0'
问题在于代码需要在哪里取 StethoInterceptor
OkHttpClient.Builder()
.addNetworkInterceptor(StethoInterceptor())
.build()
如何在没有 stetho 依赖的发布版本中编译?
【问题讨论】:
-
如果 stetho 没有为发布构建提供特殊的工件,那么您不应该为每个构建类型使用该依赖项。相反,您可以尝试有条件地添加:
if(BuildType.Debug) { add stetho } -
如果没有依赖则不编译
.addNetworkInterceptor(StethoInterceptor())
标签: android android-library stetho