In my last post I explained how
you can hack on react native for android locally, so that if you need any
change to the java packages1 you can do it yourself, with
immediate feedback upon a
One thing I immediately patched was the ability to enable remote debugging on webviews, which is turned off in react native — and here’s how you can do the same.
If you look at the
ReactWebViewManager.java you immediately notice that
debugging is commented: this is because
it needs to be enabled on the UI thread, else android is funny enough to crash the application through a RuntimeException.
Putting it in a static initializer makes it run on any thread that requires
this class, which is why is disabled.
At the same time, you can just move it around to have it enabled in your dev environment;
just place the line that enables debugging in the
1 2 3 4 5 6 7 8 9 10
and, after re-running
react native run-android, you should be good to go:
Other stuff like live screencasting work as expected:
- BTW hey, it’s 2016 and Java is still a thing! ↩