简体   繁体   中英

Debugging an Android WebView from the PC via adb

I have just recently started android development. I'm actually building a Web application that runs off an Android WebView. So, I'd like to know if there is any way to debug the web application (js,css,html) from the PC via the ADB or anything. I Googled it and got options but none have an extensive debugging facility like firebug. So, any ideas would be greatly appreciated. Thanks in advance.

Since Android 4.2 (if i'm not mistaking the version) you can:

  1. turn on development mode on your phone
  2. connect it via USB cable to your PC
  3. make sure to "Trust this computer" on the tablet/phone
  4. go to chrome://inspect on your PC in Google Chrome, you should see your device and the pages that are open on it.
  5. clicking one of the links will pop up an inspector for the respective page on the device, complete with inspect element, console, networking and everything else the Chrome inspector has.

This is how i debug my app on a Nexus 7 tablet. If your device is running an older version of Android, there's little you can do apart from console.log 's and tediously finding them through an adb logcat .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM