shriidhar
shriidhar

Reputation: 427

Chrome Inspect Device not showing android app

I am trying to debug this app using chrome://inspect - Devices, but I am not able to see my app in the debug app list. I can see the device name and only Chrome app under it, but not my app.

Settings that I have applied

I have also tried using different USB cables, different android device, but no luck.

Upvotes: 4

Views: 11939

Answers (1)

shriidhar
shriidhar

Reputation: 427

Found answer on Remote Debugging WebViews on Google Developers.

This method has been added in API Level 19, hence had to add following check

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

As mentioned in documentation, this method does not respect debuggable flag in application manifest file. If you want to enable webview debugging only when debuggable flag is true, then add one more check

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
  if (0 != (getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE))
  { 
    WebView.setWebContentsDebuggingEnabled(true); 
  }
} 

Upvotes: 4

Related Questions