software-mansion / react-native-gesture-handler

Declarative API exposing platform native touch and gesture system to React Native.
https://docs.swmansion.com/react-native-gesture-handler/
MIT License
6.03k stars 969 forks source link

Android Release app is crashing on start up, On Debug mode it is working fine #2663

Closed girimelorra closed 10 months ago

girimelorra commented 10 months ago

Description

package json

"dependencies": { "@invertase/react-native-apple-authentication": "^2.2.2", "@react-native-async-storage/async-storage": "^1.17.3", "@react-native-clipboard/clipboard": "^1.11.2", "@react-native-community/netinfo": "^8.3.0", "@react-native-firebase/analytics": "^17.5.0", "@react-native-firebase/app": "^17.5.0", "@react-native-firebase/crashlytics": "^17.5.0", "@react-native-firebase/messaging": "^17.5.0", "@react-native-firebase/perf": "^17.5.0", "@react-native-google-signin/google-signin": "^9.0.2", "@react-native-picker/picker": "^2.2.1", "@react-native-voice/voice": "^3.2.4", "@react-navigation/bottom-tabs": "^6.4.0", "@react-navigation/native": "^6.0.13", "@react-navigation/native-stack": "^6.9.0", "appcenter": "4.4.3", "appcenter-analytics": "4.4.3", "appcenter-crashes": "4.4.3", "babel-plugin-transform-remove-console": "^6.9.4", "enzyme": "^3.11.0", "enzyme-adapter-react-16": "^1.15.6", "isomorphic-fetch": "^3.0.0", "jwt-decode": "^3.1.2", "md5": "^2.3.0", "moment": "^2.24.0", "react": "18.1.0", "react-dom": "^18.2.0", "react-native": "0.68.2", "react-native-barcode-mask": "^1.2.4", "react-native-camera": "^4.2.1", "react-native-code-push": "^7.0.4", "react-native-config": "^1.4.11", "react-native-date-picker": "4.2.6", "react-native-device-info": "^8.0.1", "react-native-fast-image": "^8.5.11", "react-native-geolocation-service": "^5.3.0-beta.4", "react-native-gesture-handler": "2.10.0", "react-native-gradle-plugin": "^0.0.7", "react-native-image-pan-zoom": "^2.1.12", "react-native-linear-gradient": "^2.6.2", "react-native-loading-spinner-overlay": "^2.0.0", "react-native-moengage": "^8.4.0", "react-native-otp-verify": "^1.0.4", "react-native-permissions": "^3.8.0", "react-native-picker-select": "^8.0.4", "react-native-razorpay": "^2.2.9", "react-native-reanimated": "^2.9.1", "react-native-render-html": "^6.3.4", "react-native-safe-area-context": "^4.0.1", "react-native-screens": "^3.13.1", "react-native-shimmer-placeholder": "^1.0.35", "react-native-snackbar": "^2.4.0", "react-native-snap-carousel": "^3.9.1", "react-native-snapmint3": "^1.0.36", "react-native-swiper": "^1.6.0-rc.3", "react-native-toast-message": "^2.1.6", "react-native-tracking-transparency": "^0.1.2", "react-native-video": "^5.2.0", "react-native-webp-format": "^1.1.2", "react-native-webview": "^11.18.1", "react-redux": "^7.2.6", "redux": "^4.1.2", "redux-logger": "^3.0.6", "redux-thunk": "^2.4.1", "rn-fetch-blob": "^0.12.0", "singular-react-native": "^3.1.9" },

Error: FATAL EXCEPTION: mqt_native_modules Process: com.melorra, PID: 6664 com.facebook.react.bridge.NativeArgumentsParseException: RNGestureHandlerModule.attachGestureHandler got 2 arguments, expected 3 at com.facebook.react.bridge.JavaMethodWrapper.invoke(Unknown Source:332) at com.facebook.react.bridge.JavaModuleWrapper.invoke(Unknown Source:147) at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method) at android.os.Handler.handleCallback(Handler.java:942) at android.os.Handler.dispatchMessage(Handler.java:99) at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(Unknown Source:0) at android.os.Looper.loopOnce(Looper.java:201) at android.os.Looper.loop(Looper.java:288) at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(Unknown Source:37) at java.lang.Thread.run(Thread.java:1012)

Steps to reproduce

  1. removed node_modules
  2. Did yarn install again
  3. It got crash in release mode, in debug mode working fine

Snack or a link to a repository

NA

Gesture Handler version

2.10.0

React Native version

0.68.2

Platforms

Android

JavaScript runtime

None

Workflow

None

Architecture

None

Build type

None

Device

None

Device model

No response

Acknowledgements

Yes

github-actions[bot] commented 10 months ago

Hey! πŸ‘‹

It looks like you've omitted a few important sections from the issue template.

Please complete Snack or a link to a repository section.

github-actions[bot] commented 10 months ago

Hey! πŸ‘‹

The issue doesn't seem to contain a minimal reproduction.

Could you provide a snack or a link to a GitHub repository under your username that reproduces the problem?

j-piasecki commented 10 months ago

Could you post the output of npm ls react-native-gesture-handler and yarn why react-native-gesture-handler? It's highly likely that you have more than one version of Gesture Handler in your project (possibly because of a dependency that's configured wrong). If that's the case, using yarn resolutions to force only one version should fix the problem.

girimelorra commented 10 months ago

@j-piasecki $ yarn why react-native-gesture-handler yarn why v1.22.18 [1/4] πŸ€” Why do we have the module "react-native-gesture-handler"...? [2/4] 🚚 Initialising dependency graph... [3/4] πŸ” Finding dependency... [4/4] 🚑 Calculating file sizes... => Found "react-native-gesture-handler@2.10.0" info Has been hoisted to "react-native-gesture-handler" info This module exists because it's specified in "dependencies". info Disk size without dependencies: "5.56MB" info Disk size with unique dependencies: "11.78MB" info Disk size with transitive dependencies: "11.93MB" info Number of shared dependencies: 9

girimelorra commented 10 months ago

$ npm ls react-native-gesture-handler melorra_mob@5.1.2 /Users/giriraj/Documents/android/new_app_2/Melorra_android_reactnative └── react-native-gesture-handler@2.10.0

j-piasecki commented 10 months ago

Hmm, it seems like there's only one version. Have you tried using resolutions anyway to check if it makes any difference? You would need to add one field in package.json:

"resolutions": {
  "react-native-gesture-handler: "2.10.0"
}

You could also try using a newer version of Gesture Handler (2.13.4 is the latest).

girimelorra commented 10 months ago

Hmm, it seems like there's only one version. Have you tried using resolutions anyway to check if it makes any difference? You would need to add one field in package.json:

"resolutions": {
  "react-native-gesture-handler: "2.10.0"
}

You could also try using a newer version of Gesture Handler (2.13.4 is the latest).

Tried the above way but still getting same issue

j-piasecki commented 10 months ago

This may be a stupid question, but have you reinstalled node_modules after adding the field to package.json?

If so, could you prepare a repository with a reproduction?

girimelorra commented 10 months ago

This may be a stupid question, but have you reinstalled node_modules after adding the field to package.json?

If so, could you prepare a repository with a reproduction?

Yes I did that, sure let me try to re-produce it with new repo

girimelorra commented 10 months ago

Not sure how it is related but fixed it by changing

com.android.tools.build:gradle:7.4.2 from 7.2.2(old) (android/build.gradle)

and distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip from 7.3.3(old) (in gradle-wrapper.properties)

Thanks for support.

m-bert commented 10 months ago

We're glad to hear that it works now!

Did you have to change both versions, or just changing distributionUrl works? I've also checked which ones we are using in Gesture Handler and we have:

Maybe your app was crashing because version in your distributionUrl was older than in Gesture Handler.

girimelorra commented 10 months ago

Yeah maybe that's the case. I have updated both.