React-native-splash-screen: set canOverrideExistingModule=true

Created on 7 Feb 2018  路  3Comments  路  Source: crazycodeboy/react-native-splash-screen

with Android, I have something wrong

Here is dep:
"dependencies": {
"react": "16.2.0",
"react-native": "0.52.2"
},
"devDependencies": {
"babel-jest": "22.1.0",
"babel-preset-react-native": "4.0.0",
"jest": "22.1.4",
"react-native-action-button": "^2.8.4",
"react-native-gifted-form": "^0.1.1",
"react-native-splash-screen": "^3.0.6",
"react-native-textinput-effects": "^0.4.2",
"react-native-vector-icons": "^4.5.0",
"react-test-renderer": "16.2.0"
},

Here is Error log:
Native module SplashScreenModule tried to override SplashScreenModule for module name SplashScreen. If this was your intention, set canOverrideExistingModule=true
addNativeModule
NativeModuleRegistryBuilder.java:121
processPackage
NativeModuleRegistryBuilder.java:109
processPackage
ReactInstanceManager.java:1202
processPackages
ReactInstanceManager.java:1172
createReactContext
ReactInstanceManager.java:1107
access$900
ReactInstanceManager.java:113
run
ReactInstanceManager.java:944
run
Thread.java:818

Most helpful comment

Just in case somebody has the same issue as me.

I did not have duplicate imports. Instead I think autolinking might be causing a duplicate import.

I fixed it by removing the lines:

import org.devio.rn.splashscreen.SplashScreenReactPackage;

...

packages.add(new SplashScreenReactPackage());

So in essence, not performing any manual import for this package.

All 3 comments

check in your MainApplication, getPackages(), Make sure that under getPackages() function you don't have duplicate lines

https://stackoverflow.com/questions/41846452/how-to-set-canoverrideexistingmodule-true-in-react-native-for-android-apps

Just in case somebody has the same issue as me.

I did not have duplicate imports. Instead I think autolinking might be causing a duplicate import.

I fixed it by removing the lines:

import org.devio.rn.splashscreen.SplashScreenReactPackage;

...

packages.add(new SplashScreenReactPackage());

So in essence, not performing any manual import for this package.

If you still get the error even after removing duplicates, you may need to remove (comment) packages.add(new MyReactNativePackage()); lines for the packages that are already auto-linked (no manual installation)

Was this page helpful?
0 / 5 - 0 ratings