Net debugging in WebView

Net log

WebView supports the kLogNetLog flag to log debugging network info to a JSON file on disk.

For more info on commandline flags, see
Note: this requires either a userdebug or eng Android build (you can check with adb shell getprop Flags cannot be enabled on production builds of Android.
  1. Pick a name for the JSON file (any name will work, e.g., jsonFile=foo.json)
  2. Kill the app, if running
  3. Set the netlog flag:
    build/android/adb_system_webview_command_line --log-net-log=${jsonFile}
  4. Restart the app. Reproduce whatever is of interest, and then kill the app when finished
  5. Get the netlog off the device:
    # appPackageName is the package name of whatever app you're interested (ex.
    # WebView shell is "org.chromium.webview_shell").
    appDataDir="$(adb shell pm dump ${appPackageName} | grep 'dataDir=' | sed 's/^ *dataDir=//')" && \
    adb pull "${appDataDir}/app_webview/${jsonFile}"
  6. Import the JSON file into the NetLog viewer

For more details, see the implementation in AwUrlRequestContextGetter. For support in the network service code path, see