1

如官方网站所述,我在我的应用程序中集成了 Stetho。我可以单击正在运行的应用程序的检查按钮,并且 chrome 布局加载正常。不幸的是,我在检查模式下看不到任何数据。“stetho sample”应用程序也不起作用。

添加:

构建.gradle:

implementation 'com.facebook.stetho:stetho:1.5.0'
implementation 'com.facebook.stetho:stetho-okhttp3:1.5.0'

调整后的 MainActivity:

 @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        Stetho.initializeWithDefaults(this);

        client = new OkHttpClient.Builder()
                .addNetworkInterceptor(new StethoInterceptor())
                .build();
...

单击 Chrome stetho 布局时,我可以在日志中看到以下错误消息。

D/ChromeDevtoolsServer: Method not implemented: Not implemented: Debugger.setAsyncCallStackDepth
D/ChromeDevtoolsServer: Method not implemented: Not implemented: Debugger.skipStackFrames
D/ChromeDevtoolsServer: Method not implemented: Not implemented: Runtime.enable
D/ChromeDevtoolsServer: Method not implemented: Not implemented: Worker.enable
D/ChromeDevtoolsServer: Method not implemented: Not implemented: Timeline.enable
D/ChromeDevtoolsServer: Method not implemented: Not implemented: IndexedDB.enable
D/ChromeDevtoolsServer: Method not implemented: Not implemented: Page.getNavigationHistory
D/ChromeDevtoolsServer: Method not implemented: Not implemented: Worker.setAutoconnectToWorkers
D/ChromeDevtoolsServer: Method not implemented: Not implemented: IndexedDB.requestDatabaseNames
D/ChromeDevtoolsServer: Method not implemented: Not implemented: IndexedDB.requestDatabaseNames
D/ChromeDevtoolsServer: Method not implemented: Not implemented: Page.getNavigationHistory
D/ChromeDevtoolsServer: Method not implemented: Not implemented: Page.setColorPickerEnabled
D/ChromeDevtoolsServer: Method not implemented: Not implemented: HeapProfiler.enable
D/ChromeDevtoolsServer: Method not implemented: Not implemented: ApplicationCache.enable
D/ChromeDevtoolsServer: Method not implemented: Not implemented: ApplicationCache.getFramesWithManifests

我读到一些关于 Proguard 是原因的东西。如果这是原因,我真的无法在任何地方关闭该程序或让它正常工作。我尝试了在互联网上找到的不同方法。

例如添加到所有 proguard 配置:

-keep class com.facebook.stetho.** {*;}

试图通过以下方式关闭proguard:

  1. 从 Android SDK 文件夹中删除 proguard 目录
  2. 在 build.gradle 中设置“runProguard false”标志。

帮助将不胜感激。

4

0 回答 0