How to debug javascript in webview in android How to debug javascript in webview in android ios ios

How to debug javascript in webview in android


The easiest way to debug WebView is to connect your Android device to PC by USB and inspect your WebView by Chrome dev tools.

So, you will need:

1) Activate USB debugging on our devise. You can find it Settings >> Developer Options >> Debugging >> USB Debugging (activate checkbox)

2) Connect you devise to Computer by USB

Note: If you are developing on Windows, install the appropriate USB driver for your device. See OEM USB Drivers on the Android Developers' site.

3) Open Chrome browser and type in the URL field: chrome://inspect/#devices

4) Confirm that 'Discover USB devices' activated

5) On your device, an alert prompts you to allow USB debugging from your computer. Tap OK.

6) On the chrome://inspect page displays every connected device. Click inspect for connected device and you will get console.

More detailed manual is Debugging Android WebView


Check out weinre. It provides Chrome developer-like tools for debugging from WebKit browsers to browsers running on remote devices.


If you are not using Android 4.4, according to http://developer.android.com/guide/webapps/debugging.html you're going to enjoy the old-school way of debugging ...

If you don't have a device running Android 4.4 or higher, you can debug your JavaScript using the console JavaScript APIs and view the output messages to logcat.

For Android 4.4 and better, you'll enjoy remote debugging, see https://developers.google.com/chrome-developer-tools/docs/remote-debugging#debugging-webviews

Starting Android 4.4 (KitKat), you can use the DevTools to debug the contents of Android WebViews inside native Android applications.