CMake Error: The following variables are used in this project, but they are set to NOTFOUND.๐
What were you trying to do?
I have a simple RN project which utilises different libraries, one of them being the react-native-vision-camera. I am using the latest version 2.9.3. While building the project for android (both with run-android command or directly from android studio), i am getting a series of errors, whereas it was supposed to build without any issues.
Reproduceable Code
Not exactly sure, but can be reproduced in any blank app.
What happened instead?
When building on Android, with the following gradle settings:
buildToolsVersion = "30.0.2" minSdkVersion = 21 compileSdkVersion = 31 targetSdkVersion = 31 ndkVersion = "24.0.7856742"
... the build fails with CMAKE errors stating that some of the variables used by the project are set to NOTFOUND
Relevant log output
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
FBJNI_LIB
linked by target "VisionCamera" in directory /Users/myuser/Documents/RN Projects/proj-v2/node_modules/react-native-vision-camera/android
FOLLY_JSON_LIB
linked by target "VisionCamera" in directory /Users/myuser/Documents/RN Projects/proj-v2/node_modules/react-native-vision-camera/android
JSI_LIB
linked by target "VisionCamera" in directory /Users/myuser/Documents/RN Projects/proj-v2/node_modules/react-native-vision-camera/android
JS_ENGINE_LIB
linked by target "VisionCamera" in directory /Users/myuser/Documents/RN Projects/proj-v2/node_modules/react-native-vision-camera/android
REACT_NATIVE_JNI_LIB
linked by target "VisionCamera" in directory /Users/myuser/Documents/RN Projects/proj-v2/node_modules/react-native-vision-camera/android
REANIMATED_LIB
linked by target "VisionCamera" in directory /Users/myuser/Documents/RN Projects/proj-v2/node_modules/react-native-vision-camera/android
Device
On Android (Build fails on both M1 + Windows machine)
VisionCamera Version
2.9.3
Additional information
- [ ] I am using Expo
- [X] I have read the Troubleshooting Guide
- [X] I agree to follow this project's Code of Conduct
- [X] I searched for similar issues in this repository and found none.
Same here :/
have react-native: 0.64.0, M1 and the same error with JSI_LIB
Same
Same here with RN 0.64.2
Same error with RN 0.65.1 and react-native-vision-camera 2.9.3
Intel based Mac
buildToolsVersion = "30.0.2"
minSdkVersion = 21
compileSdkVersion = 30
targetSdkVersion = 30
ndkVersion = "20.1.5948944"
playServicesVersion = "17.0.0" //google maps
androidMapsUtilsVersion = "2.2.6" //google maps
//Only using Android Support libraries
supportLibVersion = "28.0.0"
I got it working by reading related issues #388, #338 and #513.
- I deleted my
node_modulesfolder - I ran
yarn install cd android./gradlew clean./gradlew assembleDebug- I was then confronted with the same issue in #513, so I followed this : https://github.com/mrousavy/react-native-vision-camera/issues/513#issuecomment-940857627
- It all worked! Sometimes sync fails in Android Studio, displaying no error, but within a terminal it works just fine.
I am experiencing this also, any updates as to when an official fix may get published?
Same here.
Let me quickly explain the problems:
Problem A
JSI_LIB (libjsi.so) is only available in React Native 0.65 (or 66?) and higher. VisionCamera relies on that, so either upgrade to React Native 0.66 or higher, or create a PR that adds support for older RN versions.
To add support for older RN versions, remove this and this, and add jsi.cpp below this line. (find the full path by browsing node modules)
Problem B
Your Gradle Version is 7.0.0 or higher. In that case, we might need to change this line:
https://github.com/mrousavy/react-native-vision-camera/blob/a54ff5782cf223cfe4bfff29c636c1dfbb1dc0ec/android/build.gradle#L469
to something like this:
if (task.name.contains('externalNative') || task.name.contains('CMake')) {
but I haven't tested this.
I am rolling VisionCamera in 4 production apps for clients of my app development agency (Margelo), and it works on all 4 apps. So it surely must be the older RN versions, since all of those apps are RN 0.65 and higher. I try to maintain backwards compatibility as good as I can, but I'm a single developer with 5 big open source projects to maintain, CEO at an agency and app developer - I don't have enough time to maintain support for everything.
I would greatly appreciate PRs that fix this, and am also willing to test if a PR works in all 4 of my production apps. If it does work and does not introduce a lot of complexity just for having older RN version support, I am willing to merge it.
Upgrading from react-native 0.64.2 -> 0.66.3 and following the guide from @JackStudd worked for me!
I am using Expo SDK 43 so upgrading React Native versions isn't an option, unfortunately. The fixes for adding older support doesn't work either, I will keep an eye on the issue. Are there any older, stable versions of the package that work with React Native 0.64?
This error is still happening for me on 2.10.0 (Expo SDK 44, Custom Dev Client)
@Hirbod I finally managed to build version 2.9.4 for Android using eas build (Expo SDK 44, Dev Client). See this comment.
I should've commented this earlier. I am on RN 0.66.2 so the assumption that my RN being of an old version is causing this issue is wrong! I did try the workoarounds mentioned in other threads but nothing seem to work properly. Sometimes even if the build succeeds, the application crashes on launch on Android (somehow it works on iOS, but i only tested on emulator)
I still seem to be getting this error when I refresh Gradle dependencies before building, I am using ejected Expo SDK 43 and React Native Vision v2.11.2
CMake Error: The following variables are used in this project, but they are set to NOTFOUND. Please set them or make sure they are set and tested correctly in the CMake files: FBJNI_LIB FOLLY_JSON_LIB JS_ENGINE_LIB REACT_NATIVE_JNI_LIB REANIMATED_LIB
same issue
Same here
Same issue here.
"react": "17.0.2",
"react-native": "0.65.1",
"react-native-reanimated": "^2.2.0",
"react-native-vision-camera": "2.10.0",
Same issue
"react": "^17.0.2",
"react-native": "^0.67.0",
"react-native-reanimated": "^2.8.0",
"react-native-vision-camera": "2.13.1",
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
FBJNI_LIB
linked by target "VisionCamera" in directory /../node_modules/react-native-vision-camera/android
FOLLY_JSON_LIB
linked by target "VisionCamera" in directory /../node_modules/react-native-vision-camera/android
JSI_LIB
linked by target "VisionCamera" in directory /../node_modules/react-native-vision-camera/android
JS_ENGINE_LIB
linked by target "VisionCamera" in directory /../node_modules/react-native-vision-camera/android
REACT_NATIVE_JNI_LIB
linked by target "VisionCamera" in directory /../node_modules/react-native-vision-camera/android
REANIMATED_LIB
linked by target "VisionCamera" in directory /../node_modules/react-native-vision-camera/android
Same issue
"react": "^17.0.2",
"react-native": "0.68.2",
"react-native-reanimated": "2.5.0",
"react-native-vision-camera": "^2.13.3",
CMake Error: The following variables are used in this project, but they are set to NOTFOUND. Please set them or make sure they are set and tested correctly in the CMake files: FBJNI_LIB linked by target "VisionCamera" in directory C:/Users/mauro.a.russo/Documents/projects/react-native/COIMA/node_modules/react-native-vision-camera/android FOLLY_JSON_LIB linked by target "VisionCamera" in directory C:/Users/mauro.a.russo/Documents/projects/react-native/COIMA/node_modules/react-native-vision-camera/android JSI_LIB linked by target "VisionCamera" in directory C:/Users/mauro.a.russo/Documents/projects/react-native/COIMA/node_modules/react-native-vision-camera/android JS_ENGINE_LIB linked by target "VisionCamera" in directory C:/Users/mauro.a.russo/Documents/projects/react-native/COIMA/node_modules/react-native-vision-camera/android REACT_NATIVE_JNI_LIB linked by target "VisionCamera" in directory C:/Users/mauro.a.russo/Documents/projects/react-native/COIMA/node_modules/react-native-vision-camera/android REANIMATED_LIB linked by target "VisionCamera" in directory C:/Users/mauro.a.russo/Documents/projects/react-native/COIMA/node_modules/react-native-vision-camera/android
Same issue with RN 0.68.2 Any update @mrousavy ?
@mrousavy Same issue in RN 0.68.1
Can we please reopen this issue @mrousavy? There are now 8 people with the same issue.
Thank you @mrousavy ๐
I was facing the same issue and I was using react-native-vision-camera 2.13.3, I upgraded it 2.13.5 and rebuild the project works good for me.
Can confirm with @PankajPunia. Upgrading to version 2.13.5 fixed this issue for me.
Whatโs your react-native version @PankajPunia ? I did as you but it doesnโt work
@ApWin77
"react": "17.0.2",
"react-native": "0.67.4"
Getting this issue with 2.13.5 and RN 0.68.1
Getting this issue with 2.13.5 and RN 0.68.1