4

I'm new using React Native Navigation and I'm having a problem during the installation process for Android.

So i installed the package, and followed instructions until step 5. Once there i add the code to MainApplication.java, but after doing that, i execute react-native run-android and i get the following error.

enter image description here

I read in other posts that the problem could be solved by executing npm start -- --reset-cache but that doesn't work for me.

Im using react native navigation v1.1.298

Any help will be appreciated.

Thank you.

Anupam
  • 7,966
  • 3
  • 41
  • 63
ssv08
  • 43
  • 1
  • 5

3 Answers3

2

I am facing the same problem. Looks like this library doesnt work properly with react-native version > 0.49. Because in previous react native versions it had index.android.js, index.ios.js and index.js but now it only generates a single index.js file.

You need to copy index.js file and duplicate 2 new files naming them index.android.js and index.ios.js

Note: If you are following any tutorial and have not added any routing code yet then you will get a blank screen after this step. Dont worry its just the Splash. Once you write navigation code it will work fine.

Anupam
  • 7,966
  • 3
  • 41
  • 63
1

For anyone encountering this issue on Windows while running Watchman file watch service, it is likely due to this issue https://github.com/facebook/react-native/issues/14246

Upgrading jest to version => 21.0.0 fixes the root cause.
This can be accomplished via npm i react-native@0.50.0 which will cover RN's dependents up to that version as well as npm i jest@21.2.0

Hope this helps someone

0

It's an old question.

But the problem is probably because your java entry file doesn't have getJSMainModuleName function. You can check this function if you create a new RN project.

Bright Lee
  • 2,306
  • 2
  • 27
  • 55