问题
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