Chrome浏览器检查器在AVD中显示Android Webview,但不在实际设备上显示 [英] Chrome Inspector shows Android Webview in AVD but not on actual device

查看:129
本文介绍了Chrome浏览器检查器在AVD中显示Android Webview,但不在实际设备上显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带WebView的Android应用程序,其中显示了一个简单的网页.如果我在Android Studio的AVD(虚拟设备)中运行该应用程序,则可以在Chrome Inspector中检查WebView.但是,如果我在设备上运行该应用程序,则看不到WebView.我可以看到Facebook(com.facebook.katana),也可以看到所有的Chrome标签,但WebView丢失了.

I have an Android app with a WebView which shows a simple web page. If I run the app in Android Studio's AVD (virtual device), I can inspect the WebView in Chrome Inspector. However, if I run the app on my device, I can't see the WebView. I can see Facebook (com.facebook.katana) and I can see all my Chrome tabs, but the WebView is missing.

过去,我也可以在我的设备上看到WebView,但这在几周前就停止了.(开发人员工具处于活动状态,USB调试处于活动状态)

In the past, I have been able to see the WebView on my device as well but this stopped working a few weeks ago. (Developer tools are active and USB debugging is active)

有人可以帮我弄清楚为什么无法在Chrome Inspector中检查WebView吗?

Can anyone help me figure out why the WebView is not inspectable in Chrome Inspector?

推荐答案

确保在应用程序中调用 WebView.setWebContentsDebuggingEnabled(true); (请参见

Make sure you are calling WebView.setWebContentsDebuggingEnabled(true); in your application (see https://developer.chrome.com/devtools/docs/remote-debugging#configure-webview for full info). AVD runs a "debug" Android image, where debugging of WebViews is enabled by default. On regular (so called "user") images you need to have it enabled by your app.

要考虑的另一点是,您需要至少创建一个WebView实例才能看到您的应用程序在 chrome://inspect 中列出.

Another point to consider is that you need to create at least one WebView instance in order to see your app listed in chrome://inspect.

这篇关于Chrome浏览器检查器在AVD中显示Android Webview,但不在实际设备上显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆