Home > Back-end >  react-native-gesture-handler module was not found
react-native-gesture-handler module was not found

Time:11-29

For some reason, my project does not recognize the installation of react-native-gesture-handler. The issue only appears when testing on Android devices and emulators.

The module is added to the package.json as "react-native-gesture-handler": "^1.10.3",.

The full error description:

react-native-gesture-handler module was not found. Make sure you're running your app on the native platform and your code is linked properly (cd ios && pod install && cd ..).

For installation instructions, please refer to https://docs.swmansion.com/react-native-gesture-handler/docs/#installation

I have tried following:

Any suggestions?

CodePudding user response:

I found a solution for this issue!

Even though the manual linking is deprecated in RN 0.60<, I ran a react-native link react-native-gesture-handler and this revealed that no MainApplication.java-file was found following the path in Android-folder. I looked at the path and discovered that the path was not equal to my folder structure. Yesterday I renamed the project from package com.myAppName to com.myAppName.app hence the MainApplication.java-file is now expected to be found at .../android/app/src/main/java/com/myAppName/app/MainApplication.java instead of .../android/app/src/main/java/com/myAppName/MainApplication.java. So I created an app-folder and put the MainApplication.java and MainActivity.java in there, rebuilt the project and now it's running again.

This was not an issue because of the react-native-gesture-handler module but because of a misconfiguration in the project.

  • Related