在 Android 中禁用 Google ML Kit 库的 Firebase 日志记录
如何在 Google ML Kit 库中停用 Firebase 日志记录对于安卓。每 15 分钟,它就会向 https://firebaselogging.googleapis 发布一些信息。 com/v0cc/log/batch?format=json_proto3
我尝试使用 Google 的推荐 https://firebase.google.com/docs/ perf-mon/disable-sdk?platform=android#kotlin+ktx 我也不确定这是否是正确的方法。
How can I disable the Firebase logging in Google ML Kit library for Android. For every 15 mins it will POST some information to https://firebaselogging.googleapis.com/v0cc/log/batch?format=json_proto3
I tried using the recommendation from Google https://firebase.google.com/docs/perf-mon/disable-sdk?platform=android#kotlin+ktx and I am also not sure whether it is a right way.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我正在使用 Flutter 并遇到了同样的问题。要摆脱那些烦人的“打电话回家”事件,只需在“main.dart”的开头添加这段代码即可,
我知道:这是一个肮脏的技巧,但在 Flutter(Android)上它可以工作。它开始抱怨该文件不是数据库,但它工作正常。不再需要“打电话回家”。
下周我会研究一下IOS。
I'm using Flutter and ran into the same problem. To get rid of those annoying "calling home" events just add this code just at the beginning of your 'main.dart'
I know: a dirty trick, but on Flutter (Android) it works. It starts complaining that the file is not a database, but it works fine. No more "calling home".
I'll look into IOS next week.
您可以通过将其添加到
application
标记内的应用程序清单中来删除正在进行上传的服务:You can remove the service, that is doing the uploading, by adding this to your apps manifest inside the
application
tag:该问题中的 Google 指南没有对我不起作用,所以我一直在寻找替代方案。
该库已被混淆,因此很难确定,但日志记录似乎是硬编码的。但是,有一种非常hacky的方法可以通过一些脆弱的反射来禁用它:
填充GMS TelemetryLogging时:
当您还用以下方式 可以修剪许多传递依赖项并节省 apk 大小:
但是,如上所述,这是非常脆弱的,并且可能会在 MLKit 更新后以某种方式破坏。如果不需要这个就好了。
Google's guide from the question didn't work for me, so I have looked for alternatives.
The library is obfuscated, so it is hard to be sure, but it appears that the logging is hardcoded in. However, there is a very hacky way to disable it through some fragile reflection:
When you also shim out GMS TelemetryLogging with:
it is possible to trim many transitive dependencies and save apk size:
However, as noted above, this is very fragile and will probably somehow break after MLKit update. It would be nice if this was not needed.