react-native-reanimated
react-native-reanimated copied to clipboard
[android] v3.0.0-rc.2 does not compile with monorepo
Description
If you have fabric enabled in a monorepo, you won't be able to build. The error is caused by this path assumption
https://github.com/software-mansion/react-native-reanimated/blob/main/android/CMakeLists.txt#L33
The workaround is to go in and amend it, but obviously it requires a much better solution
diff --git a/android/CMakeLists.txt b/android/CMakeLists.txt
index 835ed09db19b696cf0eb62e3e0c13e7d77e04e0b..3758ed50ca0c4d5951a7bd9dc96fb3e85eb9cf47 100644
--- a/android/CMakeLists.txt
+++ b/android/CMakeLists.txt
@@ -33,7 +33,7 @@ endif()
if(${IS_NEW_ARCHITECTURE_ENABLED})
if(${CLIENT_SIDE_BUILD})
- set (RN_SO_DIR "${CMAKE_SOURCE_DIR}/../../../android/app/build/react-ndk/exported")
+ set (RN_SO_DIR "${CMAKE_SOURCE_DIR}/../../../mobile-app/android/app/build/react-ndk/exported")
set (FBJNI_HEADERS_DIR "${CMAKE_SOURCE_DIR}/../../react-native/ReactAndroid/src/main/jni/first-party/fbjni/headers")
else()
set (RN_SO_DIR "${CMAKE_SOURCE_DIR}/../${PLAYGROUND_APP_NAME}/android/app/build/react-ndk/exported")
Steps to reproduce
- setup a monorepo
- activate fabric
- build the app
Snack or a link to a repository
Reanimated version
3.0.0-rc.2
React Native version
0.70.0
Platforms
Android
JavaScript runtime
Hermes
Workflow
React Native (without Expo)
Architecture
Fabric (New Architecture)
Build type
Debug mode
Device
Android emulator
Device model
No response
Acknowledgements
Yes
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?
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.
@andreibarabas any solutions please ?
Hey @hamdij0maa . See above the patch for the workaround. Obviously, you should make sure to replace 'mobile-app' with you actual folder name
Let me know if it works
Hey @andreibarabas, thanks for submitting the issue and for the workaround! We definitely need to fix it on our side.
Sounds good @tomekzaw
I've been spending few hours trying to resolve this, thanks @andreibarabas for posting a solution! Can I ask you how you were able to debug the problem? 🙇
glad to see it was usefull @capezzbr
Regarding how I debugged it, i started printing the build variables in the logs and then figured out which one was wrong.
Thanks for following up @andreibarabas 🙌 have you also managed to resolve this issue too https://github.com/software-mansion/react-native-reanimated/issues/3595?
That one looks like a duplicate of this one. If the path is wrong, then the other variables will be empty. See if changing the path solves it for you
That issue seem different. It seem that reanimated is referencing a Fabric
directory, that is supposed to live under the package directory (you can see it in master https://github.com/software-mansion/react-native-reanimated/tree/main/Common/cpp/Fabric) but it isn't in version 2.10 (or at least not for me)
Hey @andreibarabas , we just published 2.11.0 which hopefully should work fine in monorepo. Can you please upgrade and check if this resolves your issue?
I believe this issue was reported for v3 not v2. Also, I've tested 2.11 in a monorepo, but the issue is still there, but at least Andrei patch does work
How to deal with this problem now?thank you
@andreibarabas I'm having the same issue in our monorepo build with react-native-reanimatedv3.0.0rc.3
We had to make a similar edit as you did. Ours is as follows:
if(${IS_NEW_ARCHITECTURE_ENABLED})
if(${CLIENT_SIDE_BUILD})
- set (RN_SO_DIR "${CMAKE_SOURCE_DIR}/../../../android/app/build/react-ndk/exported")
+ set (RN_SO_DIR "${CMAKE_SOURCE_DIR}/../../../packages/${PLAYGROUND_APP_NAME}/android/app/build/react-ndk/exported")
set (FBJNI_HEADERS_DIR "${CMAKE_SOURCE_DIR}/../../react-native/ReactAndroid/src/main/jni/first-party/fbjni/headers")
else()
set (RN_SO_DIR "${CMAKE_SOURCE_DIR}/../${PLAYGROUND_APP_NAME}/android/app/build/react-ndk/exported")
This issue is currently unresolved!
Hi! I can happily inform you that as of the newest Reanimated versions, this issue is resolved!