Chrome DevTools 损坏 - Stetho 无法使用

Chrome DevTools broken - Stetho unusable

Stetho 和 Google Chrome DevTools 在 macOS 更新后变得无法使用(我怀疑 macOS 更新是这个错误的根源,但我更愿意提及它)。

这是在设备上打开“检查模式”后 DevTools 的外观(由 Facebook Stetho 库为 Android & OKHttp 提供)。

页面上不再有“CSS”样式表,字体也已更改。 许多标签页不显示(即网络请求),我只能访问一些错误消息:

There were 84 bytes that were not consumed while processing request 4
There were 84 bytes that were not consumed while processing request 5
There were 84 bytes that were not consumed while processing request 6
Failed to clear temp storage: undefined

我按照有关此问题的说明进行操作:Failed to clear temp storage and this one : Failed to clear temp storage: SecurityError in Chrome 但我无法解决问题。

这是我尝试过的:

你们有遇到过这个问题吗? 谢谢!

您应该降级 Chrome。最新 Chrome/Chromium 版本有问题 https://github.com/facebook/stetho/issues/696

在找到更好的解决方案之前,您可以下载便携式 Google Chrome 版本 87.0.4280.88 并将其特别用于调试。这样您就不需要降级您的主要 Google Chrome 应用程序 - 您可以同时使用这两个应用程序。

GoogleChromePortable_87.0.4280.88_online.paf.exe

https://sourceforge.net/projects/portableapps/files/Google%20Chrome%20Portable/

您可以使用此 https://github.com/itkacher/OkHttpProfiler 检查 api 并且它的响应类似于 android studio 中的 Stetho 库。

作为解决方法,您可以使用其他基于 Chromium 的浏览器,例如:

您还可以在其中使用 chrome://inspect/#devices 地址来检查您的数据库内容。

此时最大的缺点是您无法查看共享首选项(这在 Chromium 88 上是可能的)

对于那些想避免降级 Chrome 但仍想可视化他们的数据库的人:Stetho 是一个很棒的工具,但我刚刚发现它不再是必备工具,这要归功于 Android工作室

在 Android 工作室的最新版本中,可以转到 App Inspection 然后 Database Inspector 来执行与 Stetho 提供的对 Room 数据库的检查和操作相同。