Google remote debugging solution

Overview:

Chrome远程调试WebView是一种常用的调试技术,可以帮助开发者在WebView中调试H5页面。
使用前提:科学上网、安卓版本4.4以上、可以传输数据的数据线

Specific steps:

  1. Open developer options on your Android device and enable USB debugging mode
  2. On the PC side, enter chrome://inspect in the address bar of the Chrome browser and press the Enter key.
  3. Click on the "Devices" tab to see the connected Android devices
  4. After the mobile terminal opens the H5 page that needs to be debugged, the PC terminal can see the address of the page that needs to be debugged and click to open it.

Test package related configuration:

In the Android application, enable the remote debugging function of WebView. You can use the following code to enable remote debugging of WebView:

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
    WebView.setWebContentsDebuggingEnabled(true);
}

Precautions:

  1. The data cable must be a cable that can transmit data, and the charging cable cannot be debugged.
  2. The mobile terminal and PC need to be connected to the same LAN.
  3. If the debugging page has a white screen or 404, please visit the oil pipe to check whether the device can access the Internet scientifically.

Guess you like

Origin blog.csdn.net/m0_56516186/article/details/131260563