0

我需要在我的生产版本中删除我所有的 Timber 日志。我在 proguard-project.txt 中添加了以下内容:

-assumenosideeffects class timber.log.Timber* {
        public static *** tag(...);
        public static *** v(...);
        public static *** i(...);
        public static *** w(...);
        public static *** d(...);
        public static *** e(...);

-assumenosideeffects class timber.log.Timber.tag* {*;}
}

但是,只有格式等的日志Timber.e()Timber.i()剥离。Timber.tag(..).i(...)没有被剥离的日志。

有什么办法可以做到这一点?谢谢

4

1 回答 1

2

做某事不是更容易吗

if (BuildConfig.DEBUG) {
  Timber.plant(Timber.DebugTree())
}

在您的应用程序子类中?这样,您将仅在调试中记录日志

于 2020-06-08T09:53:14.487 回答