Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

  • Enable USB Debugging (Android Device)
  • Discover USD Devices (Chrome Dev Tools)
  • Select Debug app - App Name
  • Use USB for - File Transfer
  • Added android:debuggable="true" in Manifest file

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

like image 370
shriidhar Avatar asked Oct 27 '25 08:10

shriidhar


1 Answers

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); 
  }
} 
like image 72
shriidhar Avatar answered Oct 29 '25 23:10

shriidhar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!