software-mansion / react-native-reanimated

React Native's Animated library reimplemented
https://docs.swmansion.com/react-native-reanimated/
MIT License
8.61k stars 1.27k forks source link

[Android Release build Crash] TypeError: undefined is not an object (evaluating 'valueUnpacker.__initData.code'), stack: #5362

Closed Helen2hang closed 7 months ago

Helen2hang commented 8 months ago

Description

Hi, We are currently using reanimated with our React-native application that we created using Nx But for some reason, when we make a release build on Android, it keeps crashing directly after the splash screen. Important to note: It doesn't crash on Android debug build.

When we used logcat to find the crash error message, we saw this error message: image

We disabled Hermes to see the error in more detail, and we saw this error message.

TypeError: undefined is not an object (evaluating 'valueUnpacker.__initData.code'), stack:

image

I found that it comes from the code of Reanimated in this PR: https://github.com/software-mansion/react-native-reanimated/pull/4944/files.

We do have react-native-reanimated/plugin is listed in our babel.config.js, so I am not sure what else we are missing.

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

Maybe we are missing an important @babel package? Can someone list me the @babel package that are necessary for reanimated to work properly? Or if someone knows what we are missing that could cause the crash to only happen on release mode but not on debug mode...

Steps to reproduce

It's more related to our project, so I don't think it is easy to reproduce.

Snack or a link to a repository

-

Reanimated version

3.5.4

React Native version

0.72.3

Platforms

Android

JavaScript runtime

None

Workflow

React Native

Architecture

Paper (Old Architecture)

Build type

Release mode

Device

Android emulator

Device model

Pixel 7 Pro API 31, Android 12

Acknowledgements

Yes

github-actions[bot] commented 8 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?

github-actions[bot] commented 8 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.

Helen2hang commented 7 months ago

sorry, it's not an issue with reanimated. Our NX project was not well setup. It wasn't detecting the babel.config in the mobile project for android release build for some reason.

ChenShiChao commented 3 months ago

this error:

2024-03-14 11:29:19.132 6945-6971/com.my.app E/ReactNativeJS: Error: Requiring module "635", which threw an exception: TypeError: undefined is not an object (evaluating 'valueUnpacker.__initData.code')

--------- beginning of crash

2024-03-14 11:29:19.142 6945-6972/com.my.app E/AndroidRuntime: FATAL EXCEPTION: mqt_native_modules Process: com.evergrande.hamapp, PID: 6945 com.facebook.react.common.JavascriptException: Error: Requiring module "635", which threw an exception: TypeError: undefined is not an object (evaluating 'valueUnpacker.__initData.code'), stack: h@2:1600

@1015:719 h@2:1709 @1011:332 h@2:1709 @1009:634 h@2:1709 @1007:2648 h@2:1709 @576:334 h@2:1709 @556:261 h@2:1709 @554:1570 h@2:1709 @553:704 h@2:1709 @547:112 h@2:1709 @546:364 h@2:1709 @545:101 h@2:1709 @541:73 h@2:1709 @540:47 h@2:1709 @384:154 h@2:1709 @6:57 h@2:1709 d@2:1082 global code@2403:3 at com.facebook.react.modules.core.ExceptionsManagerModule.reportException(ExceptionsManagerModule.java:72) at java.lang.reflect.Method.invoke(Native Method) at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372) at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:188) at com.facebook.jni.NativeRunnable.run(Native Method) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27) at android.os.Looper.loop(Looper.java:223) at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:228) at java.lang.Thread.run(Thread.java:923)
576 commented 3 months ago

这是来自QQ邮箱自动回复邮件. 您的邮件我已经收到,谢谢祝您愉快!!!

richao03 commented 2 months ago

@Helen2hang can you share your fix please? i am running into the same error

576 commented 2 months ago

这是来自QQ邮箱自动回复邮件. 您的邮件我已经收到,谢谢祝您愉快!!!

Helen2hang commented 2 months ago

The problem is because the babel.config was being looked for from the root of the project instead the mobile folder. To fix it, we changed the root parameter inside the build.gradle so that it enters in the mobile folder.

richao03 commented 2 months ago

my issue turned out not not related to reanimated either, my azure task was pointing the working directory to our android/wrapperAndroid/ directory instead of android/, this break happened when updating react-native from 0.68.5 to react-native 0.71.14, thank you @Helen2hang for pointing me in the right direction!!!

JamesBondPc commented 2 weeks ago

The problem is because the babel.config was being looked for from the root of the project instead the mobile folder. To fix it, we changed the root parameter inside the build.gradle so that it enters in the mobile folder.

show code

576 commented 2 weeks ago

这是来自QQ邮箱自动回复邮件. 您的邮件我已经收到,谢谢祝您愉快!!!