Remote Debugging Android

Remote Debugging Android with chrome://inspect

Capacitor 243,123 turns on WebView debugging in debuggable builds: Bridge.java calls WebView.setWebContentsDebuggingEnabled() with the android.webContentsDebuggingEnabled setting, which defaults to true exactly when the APK is debuggable (System WebViews). With the device on adb, open chrome://inspect/#devices in desktop Chrome 1 and click inspect under WebView in com.example.booknest: the full DevTools opens on the app, with the phone's screen mirrored beside it.

Under the hood, each debuggable WebView listens on a Unix socket named after its process, and Chrome reaches it through adb forward, as this chapter's scripts did:

What chrome://inspect does, by hand
PID=$(adb -s emulator-5558 shell pidof com.example.booknest)
adb -s emulator-5558 forward tcp:9222 localabstract:webview_devtools_remote_$PID
curl -s http://localhost:9222/json
Output
9222
[ {
...
   "id": "2EABD6F8027E41EDEDB39497C300E3EE",
   "title": "Salt and Saffron · BookNest",
   "type": "page",
   "url": "https://localhost/",
   "webSocketDebuggerUrl": "ws://localhost:9222/devtools/page/2EABD6F8027E41EDEDB39497C300E3EE"
} ]

The webSocketDebuggerUrl speaks the Chrome DevTools 3,948 Protocol, which End-to-End Testing builds a test on. /json/version reported the WebView as Chrome 133: test against that, not your desktop Chrome. Release builds are not debuggable; never set android.webContentsDebuggingEnabled: true for production.