Debugging Android WebViews in React Native
I need to check the webview content and network requests that I have running inside my application. With iOS, I can open the simulator, open Safari, and then I can test the webview just like on any other site.
I'm having problems with Android. I went to chrome: // check and can check Chrome on the connected device, however I cannot check the webview.
I tried to move webView.setWebContentsDebuggingEnabled(true);
inside ReactWebViewManager.java to a method onPageStarted
so that it is always included, but that had no effect.
thank
OK, so we're working now.
What we did in our application is what we call WebView.setWebContentsDebuggingEnabled(true);
inside the method of onCreate
our MainActivity.java (located in android / app / src / main / java / com / [appname]).
I'm not sure if it has a method onCreate
out of the box, so you might have to add it or try it elsewhere - we must have read the same article as you did before and moved the call to the method onPageStarted ReactWebViewManager.java but that didn't work for me either.
setWebContentsDebuggingEnabled is a static method of android.webkit.WebView, so just make sure you have this import.
Hope this helps you.