react-native-vision-camera: Error when building for Android 🐛
What were you trying to do?
Whenever I go to build, an error occurs saying that the file is missing. I’ve tested with other versions but still. Could anyone help?
Reproduceable Code
gradlew assembleRelease
What happened instead?
Relevant log output
The following error always occurs:
C/C++: ../../../../build/third-party-ndk/folly\folly/dynamic.h:63:10: fatal error: 'boost/operators.hpp' file not found
Device
Android
VisionCamera Version
2.12.2
Additional information
- I am using Expo
- I have read the Troubleshooting Guide
- I agree to follow this project’s Code of Conduct
- I searched for similar issues in this repository and found none.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 3
- Comments: 27 (1 by maintainers)
Same issue for me. Vision camera download “boost_${BOOST_VERSION}.tar.gz” from github, unzip it.
After that, in doLast block of the prepareBoost task renames the file to boost:
but the file is not renamed for some reason. So we got “‘boost/operators.hpp’ file not found” error.
Manually rename folder after first build works for me
the first time visionCamera builds it installs this library https://github.com/react-native-community/boost-for-react-native something wrong happens there. sometimes it builds fine and creates a folder called
boost
, other times it names itboost_1_63_0
and as a result boost/operators.hpp can’t be found. Can’t be clearer than this honestly. can this bedefinitively
resolved? I don’t know, mrousavy might be able to solve it.When I try this: go to \node_modules\react-native-vision-camera\android\build\third-party-ndk I find the boost folder named “boost_1_63_0”, I rename it to just “boost”. the build works, but this time I get the following error in the react-native start terminal
and if I delete the build and .cxx folders, then start clean cache, it builds fine but again crashes if I rebuild.
If I rename the first folder
boost
toboost_1_63_0
, I get the following error:Getting the following error with version 2.13.3:
There is a folder
.../node_modules/react-native-vision-camera/android/build/third-party-ndk/boost/boost
How can I build the production version without error?
I have been working on the development build including frame processors no problem.
Hello ! I have a similar error with folly and I think that is the same :
node_modules/react-native/ReactCommon/cxxreact/CxxModule.h:15:10: fatal error: 'folly/dynamic.h' file not found
I needed to disable FrameProcessors to build (https://mrousavy.com/react-native-vision-camera/docs/guides/frame-processors/#android) but we will soon need frame processors 😕
@RafaelA977 found the problem in the build.gradle file (see above). The reason is, that gradle cannot rename the directory (from boost_1_63_0 to boost). For more details see gradle documentation “Gradle has no API for moving files and directories around, but you can use the Apache Ant integration to easily do that”
https://docs.gradle.org/current/userguide/working_with_files.html#sec:moving_files_example
Solution:
Comment (or remove) the line
//file(“$thirdPartyNdkDir/boost_${BOOST_VERSION}”).renameTo(“$thirdPartyNdkDir/boost”)
and replace it with
ant.move(file: “$thirdPartyNdkDir/boost_${BOOST_VERSION}”, tofile: “$thirdPartyNdkDir/boost”, quiet: “false”)
I’m getting this issue when building for production. In development, it builds fine.
Please check my comment above. inside
\node_modules\react-native-vision-camera\android\build\third-party-ndk
there is a folder that should be namedboost
for some reason it gets namedboost_1_63_0
that’s why boost/operators.hpp can’t be found. If you rename it to the correct nameboost
the error goes away. that’s not a solution AT ALL, I’m posting this to make you aware of the source of the problem.