react-native-vision-camera: 🐛 Android build error when using frame processor: 'folly/dynamic.h' file not found

What were you trying to do?

First, thank you for this great library!! 😃

It was working fine until I updated to 2.15.2 and reanimated to 2.12 (I was using 2.14.1 reanimated 2.10 with before that). I’m now getting a build error (on Windows) when trying to use a frame processor.

It’s the not the same error as reported in issue #1283

I’m using the following package version: react-native-vision-camera: 2.15.2 react-native-reanimated: 2.12.0

The builds works on EAS though, so it might be a Windows specific issue?

Reproduceable Code

npx create-react-native-app myapp -t with-typescript
cd myapp
yarn expo prebuild
yarn expo install react-native-vision-camera
yarn expo install react-native-reanimated
yarn expo run:android

What happened instead?

Getting an Android compilation error when building on Windows.

Relevant log output

> Task :react-native-vision-camera:buildCMakeDebug[arm64-v8a] FAILED
C/C++: ninja: Entering directory `C:\Users\Olivier\Documents\dev\systemic\myapp\node_modules\react-native-vision-camera\android\.cxx\Debug\2x3o1x4w\arm64-v8a'
C/C++: In file included from ../../../../src/main/cpp/JSIJNIConversion.cpp:16:
C/C++: C:/Users/Olivier/Documents/dev/systemic/myapp/node_modules/react-native/ReactAndroid/src/main/jni\react/jni/NativeMap.h:11:10: fatal error: 'folly/dynamic.h' file not found
C/C++: In file included from ../../../../src/main/cpp/VisionCamera.cpp:3:
C/C++: In file included from ../../../../src/main/cpp/FrameProcessorRuntimeManager.h:14:
C/C++: In file included from ../../../../src/main/cpp/reanimated-headers/AndroidScheduler.h:8:
C/C++: In file included from C:/Users/Olivier/Documents/dev/systemic/myapp/node_modules/react-native/ReactAndroid/src/main/jni\react/jni/CxxModuleWrapper.h:10:
C/C++: In file included from C:/Users/Olivier/Documents/dev/systemic/myapp/node_modules/react-native/ReactAndroid/src/main/jni\react/jni/CxxModuleWrapperBase.h:13:
C/C++: C:/Users/Olivier/Documents/dev/systemic/myapp/node_modules/react-native/ReactCommon\cxxreact/CxxModule.h:15:10: fatal error: 'folly/dynamic.h' file not found
C/C++: In file included from ../../../../src/main/cpp/FrameProcessorRuntimeManager.cpp:5:
C/C++: In file included from ../../../../src/main/cpp/FrameProcessorRuntimeManager.h:14:
C/C++: In file included from ../../../../src/main/cpp/reanimated-headers/AndroidScheduler.h:8:
C/C++: In file included from C:/Users/Olivier/Documents/dev/systemic/myapp/node_modules/react-native/ReactAndroid/src/main/jni\react/jni/CxxModuleWrapper.h:10:
C/C++: In file included from C:/Users/Olivier/Documents/dev/systemic/myapp/node_modules/react-native/ReactAndroid/src/main/jni\react/jni/CxxModuleWrapperBase.h:13:
C/C++: C:/Users/Olivier/Documents/dev/systemic/myapp/node_modules/react-native/ReactCommon\cxxreact/CxxModule.h:15:10: fatal error: 'folly/dynamic.h' file not found

Device

Not relevant

VisionCamera Version

2.15.2

Additional information

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 4
  • Comments: 23 (2 by maintainers)

Commits related to this issue

Most upvoted comments

In my case only the production build was failing: Helped this https://mrousavy.com/react-native-vision-camera/docs/guides/frame-processors#android

I also solved this by removing REACT_NATIVE_DOWNLOADS_DIR, which I agree doesn’t seem to be reusing the downloaded dependencies, and then clearing my dependencies:

unset REACT_NATIVE_DOWNLOADS_DIR
cd android && ./gradlew clean
cd .. && rm -rf node_modules/
yarn
npx expo prebuild
npx expo run:android

I am facing the same issue on production only build (creating a aab file):

node_modules/react-native/ReactAndroid/src/main/jni/react/jni/NativeMap.h:11:10: fatal error: 'folly/dynamic.h' file not found


OS: macOS Ventura 13.1 reanimated: 2.13.0 vision-camera: 2.15.4

normal builds to the emulator are fine… Do anyone know how this can be fixed?

FIXED: cd android && ./gradlew clean fixed it for me

if you have set a custom path for REACT_NATIVE_DOWNLOADS_DIR on your env, make sure it clean or delete any existing downloaded tar.gz files, in my case i have multiple folly-*.tar.gz files so I think vision camera pick the wrong one

edit: it seems vision camera didn’t reuse downloaded dependencies correctly, it need to redownload everything so it can build correctly

The issue occurred with me when I had multiple project using the root reactNativeDownloads dir and the versions of folly were different from each other

all I had to do is to clear the root directory and everything worked!

that was my case

I met this issue again today suddenly. The build is smooth until once failed with no reason. Fixed by repeating remove node_modules -> install dependencies -> build failed -> remove node_modules about 3 hours. I only need the function to scan QR code, I think I will find another replacement after my code release this time. It takes me too many times to wait for the luck.

Oh, I’m not using expo.

I got errors:

node_modules/react-native/ReactAndroid/src/main/jni/react/jni/NativeMap.h:11:10: fatal error: 'folly/dynamic.h' file not found
node_modules/react-native/ReactCommon/cxxreact/CxxModule.h:15:10: fatal error: 'folly/dynamic.h' file not found

I met the same issue. Resolved by fixing the react-native-reanimated’s version to 2.12.0. @obasille hope this can be helpful.

Hi @FDiskas, thanks for your reply. The link you send mentions disabling frame processors, but I need to use them 😃