- Enable Developer Options in Device (Settings-->About Phone-->Tap 7 times on build number)
- Turn on Developer options and Enable USB Debugging (in Developer Options)
-
Add this line in your custom Application class or in the Activity where the Web View is loaded
// if your build is in debug mode, enable inspecting of web views
if (0 != (getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE)) { WebView.setWebContentsDebuggingEnabled(true); }
-
Open Chrome and type
chrome://inspect/#devices
and you should see your device in the Remote Target List - Click on inspect to debug it.
如果inspect的时候出现空白页,可能是Chrome的bug,试试用Edge,参考:https://stackoverflow.com/questions/66670000/android-chrome-inspect-devices-blank-screen
评论