Webview debugging via chrome://inspect can be very useful when reverse engineering hybrid applications (Cordova etc). Using Frida we can overwrite the constructors and always enable debugging.

// Enable debugging on Android webviews

/*
 You might not need to hook all of the constructors, assuming that the 
 ones with less parameters just use defaults;
 you would be able to only hook the root one (ie, the constructor that is called by all the other constructors). 
 */

Java.perform(() => {
	let android_webkit_WebView = Java.use("android.webkit.WebView")

	android_webkit_WebView.$init.overload("android.content.Context").implementation = function (android_content_Context_0) {
		let returnValue = this.$init.apply(this, arguments)
		this.setWebContentsDebuggingEnabled(true)
		console.log("Enabling debugging")
		return returnValue
	}

	android_webkit_WebView.$init.overload("android.content.Context", "android.util.AttributeSet").implementation = function (android_content_Context_0, android_util_AttributeSet_1) {
		let returnValue = this.$init.apply(this, arguments)
		this.setWebContentsDebuggingEnabled(true)
		console.log("Enabling debugging")
		return returnValue
	}

	android_webkit_WebView.$init.overload("android.content.Context", "android.util.AttributeSet", "int").implementation = function (android_content_Context_0, android_util_AttributeSet_1, int_2) {
		let returnValue = this.$init.apply(this, arguments)
		this.setWebContentsDebuggingEnabled(true)
		console.log("Enabling debugging")
		return returnValue
	}

	android_webkit_WebView.$init.overload("android.content.Context", "android.util.AttributeSet", "int", "int").implementation = function (android_content_Context_0, android_util_AttributeSet_1, int_2, int_3) {
		let returnValue = this.$init.apply(this, arguments)
		this.setWebContentsDebuggingEnabled(true)
		console.log("Enabling debugging")
		return returnValue
	}

	android_webkit_WebView.$init.overload("android.content.Context", "android.util.AttributeSet", "int", "int", "java.util.Map", "boolean").implementation = function (android_content_Context_0, android_util_AttributeSet_1, int_2, int_3, java_util_Map_4, boolean_5) {
		let returnValue = this.$init.apply(this, arguments)
		this.setWebContentsDebuggingEnabled(true)
		console.log("Enabling debugging")
		return returnValue
	}

	android_webkit_WebView.$init.overload("android.content.Context", "android.util.AttributeSet", "int", "java.util.Map", "boolean").implementation = function (android_content_Context_0, android_util_AttributeSet_1, int_2, java_util_Map_3, boolean_4) {
		let returnValue = this.$init.apply(this, arguments)
		this.setWebContentsDebuggingEnabled(true)
		console.log("Enabling debugging")
		return returnValue
	}
})