-->

Cannot get remote WebView debugging to run on Andr

2019-09-09 03:44发布

问题:

I'm trying to enable remote debugging for WebViews on a Trigger.io app running on Nexus 7 (Android 4.4.3). I've created a native module to set the Webview property with the following method:

public static void enableWebViewDebugging(final ForgeTask task) {
    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) {
        WebView.setWebContentsDebuggingEnabled(true);
    }
    task.success();
}

I call it from JS with forge.internal.call('utils.enableWebViewDebugging', {}, null, null); a few seconds after the app started.

When looging at the chrome://inspect/#devices tab, I only see Chrome browser tabs, but no native WebView/app whatsoever.

Is there anything wrong with the way I set the property? I could imagine, that the WebView property must be set during a specific startup/oncreate method, however is that even possible with Trigger.io?

回答1:

Trigger.io natively supports remote debugging for Android > 4.4 so you shouldn't need to create your own custom module.

To enable it you can go to your app config in Trigger Toolkit and enable the checkbox at: Core => Android => Remote Debugging

Alternatively, edit your src/config.json file directly and add the 'remote_debugging' key to the core.android section:

"core": {
                "android": {
                        "remote_debugging": true,
                }
},