Search code examples
androidreact-nativenpmmanualnpm-link

how to manual link npm package 'react native reanimated'


Can anyone please tell me how to manual link

react-native-reanimated

because the automatic cli linking not working and crashing react native app


Solution

  • In Android,Add the following lines to android/settings.gradle

    include ':react-native-reanimated' project(':react-native-reanimated').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-reanimated/android')

    Add the compile line to the dependencies in android/app/build.gradle

    implementation project(':react-native-reanimated')

    the import and link the package in MainApplication.java

    import com.swmansion.reanimated.ReanimatedPackage;

    protected List<ReactPackage> getPackages() {
      return Arrays.<ReactPackage>asList(
             new ReanimatedPackage(), );// <-- add this line
    }
    }
    

    in android/build.gradle

    ext {
    compileSdkVersion           = 25
    targetSdkVersion            = 25
    buildToolsVersion           = "25.0.2"
    googlePlayServicesVersion   = "12.0.1"
    supportLibVersion           = "27.0.0"
     }