Debugging webview for Android in Chrome inspect tab with Expo
See original GitHub issueI’m using Expo with your plugin for the webview. My Android emulator has USB debugging enabled. It’s Android 9 and the WebView implementation is Chrome.
When I go to the inspect tab in Chrome via chrome://inspect/#devices I see this:
There’s no link to the webview where my code is running so I can’t inspect the javascript and html or see why network requests may fail for the webview.
I read here https://forums.expo.dev/t/cant-debug-webview-in-device-on-android-without-detaching/10153 that I need to eject Expo in order to set:
WebView.setWebContentsDebuggingEnabled(true);
This apparently can’t be set via a boolean flag in the <WebView> tag.
So can you please create a version of your plugin where ‘setWebContentsDebuggingEnabled(true)’ is used by default, perhaps with an installation property? I desperately need to debug my webview with Expo as the wrapper.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:6
Top GitHub Comments
After 2 days of experimenting this is how I managed to debug the webivew in Chrome on my laptop of the webview running on my Android phone:
Ensure USB debugging is enabled on the device
Ensure the WebView implementation is Chrome on the device
In my Webstorm, in the project’s terminal I wrote:
expo run:android
This added the /android folder to my project and all of the dependencies to run the Android app.I navigated to /android/app/src/man/java/com/<project name>/MainApplication.java and edited it as follows:
expo run:android
It opened the app on my Android phone still in the Expo app I waited for the WebView to open and show my page
I saw the link to let me inspect the webview:
Clicking the link showed the Chrome inspect tab of my webview running on my Android phone!
@realfresh Can you explain the steps? I have created a file like this in the root folder. Added the plugin inside app.json file. What’ the next step?