简体   繁体   English

Chrome检查设备未显示android应用

[英]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. 我正在尝试使用chrome:// inspect-设备调试该应用,但在调试应用列表中看不到我的应用。 I can see the device name and only Chrome app under it, but not my app. 我可以看到设备名称,并且只能看到其下的Chrome应用程序,但看不到我的应用程序。

Settings that I have applied 我套用的设定

  • Enable USB Debugging (Android Device) 启用USB调试(Android设备)
  • Discover USD Devices (Chrome Dev Tools) 发现美元设备(Chrome开发工具)
  • Select Debug app - App Name 选择调试应用-应用名称
  • Use USB for - File Transfer 使用USB进行-文件传输
  • Added android:debuggable="true" in Manifest file 在清单文件中添加了android:debuggable =“ true”

I have also tried using different USB cables, different android device, but no luck. 我也尝试过使用不同的USB电缆,不同的android设备,但是没有运气。

Found answer on Remote Debugging WebViews on Google Developers. 在Google Developers的远程调试WebView上找到了答案。

This method has been added in API Level 19 , hence had to add following check 此方法已在API级别19中添加,因此必须添加以下检查

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 如果您只想在debuggable标志为true时启用webview调试,则再添加一项检查

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM