Chrome Inspector shows Android Webview in AVD but not on actual device

一个人想着一个人 提交于 2021-01-28 03:53:23

问题


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.

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)

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


回答1:


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.

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.




回答2:


For me...the DeVTools window is blank...ive tried this for both our app and viewing Chrome through the devive



来源:https://stackoverflow.com/questions/33679763/chrome-inspector-shows-android-webview-in-avd-but-not-on-actual-device

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!