Search code examples
react-nativereact-native-reanimated-v2

TypeError: undefined is not an object (evaluating 'InnerNativeModule.installCoreFunctions')


my react-native project was running, but today i tired to run it on andorid it gived the the abouve Error TypeError: undefined is not an object (evaluating 'InnerNativeModule.installCoreFunctions'). tried alot of thing gradlew clean node modules deleted cache-clear but no thing works


Solution

  • Hello Here is the solution. go to android/app/build.gradle and search for the line

    project.ext.react = [
        enableHermes: false,  // clean and rebuild if changing
    ]
    

    change this to

    project.ext.react = [
        enableHermes: true,  // clean and rebuild if changing
    ]
    

    and in MainApplication.java file add these two line to the top

    import com.facebook.react.bridge.JSIModulePackage;
    import com.swmansion.reanimated.ReanimatedJSIModulePackage;
    

    and add this function

    @Override
    protected JSIModulePackage getJSIModulePackage() { 
          return new ReanimatedJSIModulePackage(); 
        }
    

    Here is the screen shotenter image description here

    in the bable.config.js file add these ,lines like this

    module.exports = {
      presets: ['module:metro-react-native-babel-preset'],
      plugins: [
        "react-native-reanimated/plugin",
      ],
    };
    

    and index.js

    import 'react-native-gesture-handler'
    

    After this clean your project, uninstall from the device and build it again. Cheers!!