Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 882
user2783434 Avatar asked Nov 23 '22 14:11

user2783434


1 Answers

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.

like image 197
Teodor Sandu Avatar answered Dec 05 '22 18:12

Teodor Sandu