Android remote debugging for Phonegap app does not work Android remote debugging for Phonegap app does not work google-chrome google-chrome

Android remote debugging for Phonegap app does not work


The problem is that remote debugging used to only work for the Chrome browser on Android, but not in webviews inside of apps like phonegap uses. But with Android 4.4 (Kitkat) and Phonegap 3.3, this is now supported.

I wrote a blog post about it here:

http://adamwadeharris.com/remote-debugging-in-phonegap-with-chrome-devtools/

Basically you need to enable webview debugging in the app's main Java file, and make sure your app is targeting API version 19 (Kitkat). If you don't have a device with Kitkat, you could use an emulator instead.

Here's how you enable webview debugging:

In platforms/android/src/com/yourAppName/YourAppName.java add the following lines under the other import statements

import android.os.Build;import android.webkit.WebView;

And add the following inside the onCreate method:

if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {  WebView.setWebContentsDebuggingEnabled(true);}


As it is already said in some comments, this is working out of the box since cordova 3.3+ and android 4.4+. You do not need to set anything in the AndroidManifest.xml.

If you use cordova build or cordova run the default build mode will be "debug". You can see this also in the generated apk file name which will look like:

{app_name}-debug-unaligned.apk

In this case you just need Chrome in Version 32+ and select Chrome menu > Tools > Inspect Devices (of course after you deployed the app to your device and turned on usb debugging).

For additional info look also here: https://developer.chrome.com/devtools/docs/remote-debugging

Concerning the authentication problem... When you first run cordova android run your app will be deployed to your phone and you need to confirm the authentication dialog and make a tick to remember your choice. After this you should be good to inspect the deployed app in the chrome inspector.


It seems to be a bug on the phone.I fixed by doing:

  1. Select Developer options
  2. Revoke USB debugging authorized
  3. turn off and on the USB debugging switch
  4. connect to your PC
  5. now, just accept the two authority dialog, and it will work fine in AndroidStudio and Chrome.