By: Niraj Dhungana
Feb 27 2022
In one of my react native projects I needed some Native Java code. Like always I went to google and searched for the keyword and applied the solution. But in the end I got null inside my console for Native Module.
The reason for getting Native Module null is not because I wrote wrong code or I didn’t follow properly. The reason is very simple but no one is mentioning it in their posts or tutorials.
And I know you are here to find the solution not to read my lecture. So the solution is not just one step. You need to try multiple things but trust me, the solution will work 100%.
The very first thing that you can try to solve that RN Module null is by enabling debug mode. If you don’t know how to enable it then simply press D inside the terminal from which you are running your react native app.
Then your app will show you some options and you have to choose debug.
Note: After enabling debug mode you will see all the log messages inside your browser where the debug server is running.
If you are still getting null for your Native Module you should uninstall your app from the device or emulator whichever tool you are using. Then terminate your react native server and restart it again.
With these two techniques you should have solved your issue but if you are still getting null then apply all of the solutions at once which I mentioned above.
Like first uninstall your app, restart the server and then enable the debug mode. These solutions worked for me. So I hope it will work for you as well.