how to enable WebKit's remote debugging/inspector of Android app using WebView?

前端 未结 5 2001
野趣味
野趣味 2020-12-06 05:27

I need to inspect javascript execution (webview widget) in an android application, while debugging; through SDK & usb cable and/or http/websockets; from destop compute

5条回答
  •  执念已碎
    2020-12-06 05:59

    For android >= 4.4 (kitkat)

    See Remote debugging on Android with Chrome

    For android < 4.4 (Lower versions)

    Use very good open source tool: weinre. See this video for help to use it. If you are familiar with grunt then you can use grunt-weinre

    For quick view:

    1. install weinre using npm
    2. Do the configuration in your gruntfile.
    3. Run the weinre grunt task.
    4. Use this script to inject the weinre target code into your web page.
    1. Open http://localhost:8082 in your browser and you will find devices running above script. You can debug all this devices.

    NOTE: if you want to debug webview/browser in your mobile device then you need to replace localhost with your machine's IP running weinre. And yes, all the devices should be on the same network.

提交回复
热议问题