react-native-vision-camera: š§ V2.16.1 and react-native 0.72.4 android Execution failed for task ':react-native-vision-camera:buildCMakeDebug[arm64-v8a]'.
How were you trying to build the app?
npx react-native run-android
Full build logs
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-vision-camera:buildCMakeDebug[arm64-v8a]'.
> com.android.ide.common.process.ProcessException: ninja: Entering directory `/home/ubuntu/Documents/ReactNative/CameraTest/node_modules/react-native-vision-camera/android/.cxx/Debug/3r1h2y4e/arm64-v8a'
[1/10] Building CXX object CMakeFiles/VisionCamera.dir/src/main/cpp/java-bindings/JFrameProcessorPlugin.cpp.o
[2/10] Building CXX object CMakeFiles/VisionCamera.dir/src/main/cpp/FrameHostObject.cpp.o
[3/10] Building CXX object CMakeFiles/VisionCamera.dir/src/main/cpp/VisionCamera.cpp.o
[4/10] Building CXX object CMakeFiles/VisionCamera.dir/src/main/cpp/java-bindings/JHashMap.cpp.o
[5/10] Building CXX object CMakeFiles/VisionCamera.dir/src/main/cpp/FrameProcessorRuntimeManager.cpp.o
[6/10] Building CXX object CMakeFiles/VisionCamera.dir/src/main/cpp/VisionCameraScheduler.cpp.o
[7/10] Building CXX object CMakeFiles/VisionCamera.dir/src/main/cpp/java-bindings/JImageProxy.cpp.o
[8/10] Building CXX object CMakeFiles/VisionCamera.dir/src/main/cpp/CameraView.cpp.o
[9/10] Building CXX object CMakeFiles/VisionCamera.dir/src/main/cpp/JSIJNIConversion.cpp.o
[10/10] Linking CXX shared library ../../../../build/intermediates/cxx/Debug/3r1h2y4e/obj/arm64-v8a/libVisionCamera.so
FAILED: ../../../../build/intermediates/cxx/Debug/3r1h2y4e/obj/arm64-v8a/libVisionCamera.so
: && /home/ubuntu/Android/Sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=aarch64-none-linux-android21 --sysroot=/home/ubuntu/Android/Sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/linux-x86_64/sysroot -fPIC -fexceptions -frtti -std=c++1y -DONANDROID -DFOR_HERMES=1 -g -fno-limit-debug-info -Wl,--build-id=sha1 -Wl,--no-rosegment -Wl,--fatal-warnings -Qunused-arguments -Wl,--no-undefined -shared -Wl,-soname,libVisionCamera.so -o ../../../../build/intermediates/cxx/Debug/3r1h2y4e/obj/arm64-v8a/libVisionCamera.so CMakeFiles/VisionCamera.dir/src/main/cpp/VisionCamera.cpp.o CMakeFiles/VisionCamera.dir/src/main/cpp/JSIJNIConversion.cpp.o CMakeFiles/VisionCamera.dir/src/main/cpp/FrameHostObject.cpp.o CMakeFiles/VisionCamera.dir/src/main/cpp/FrameProcessorRuntimeManager.cpp.o CMakeFiles/VisionCamera.dir/src/main/cpp/CameraView.cpp.o CMakeFiles/VisionCamera.dir/src/main/cpp/VisionCameraScheduler.cpp.o CMakeFiles/VisionCamera.dir/src/main/cpp/java-bindings/JFrameProcessorPlugin.cpp.o CMakeFiles/VisionCamera.dir/src/main/cpp/java-bindings/JImageProxy.cpp.o CMakeFiles/VisionCamera.dir/src/main/cpp/java-bindings/JHashMap.cpp.o /home/ubuntu/.gradle/caches/transforms-3/0eba9a168eb8819dccb7829f2ba40fb2/transformed/jetified-hermes-android-0.72.4-debug/prefab/modules/libhermes/libs/android.arm64-v8a/libhermes.so /home/ubuntu/.gradle/caches/transforms-3/6fe00d6361b0f0c55549aec89a7f6742/transformed/jetified-react-android-0.72.4-debug/prefab/modules/folly_runtime/libs/android.arm64-v8a/libfolly_runtime.so /home/ubuntu/.gradle/caches/transforms-3/6fe00d6361b0f0c55549aec89a7f6742/transformed/jetified-react-android-0.72.4-debug/prefab/modules/glog/libs/android.arm64-v8a/libglog.so /home/ubuntu/.gradle/caches/transforms-3/6fe00d6361b0f0c55549aec89a7f6742/transformed/jetified-react-android-0.72.4-debug/prefab/modules/jsi/libs/android.arm64-v8a/libjsi.so /home/ubuntu/.gradle/caches/transforms-3/6fe00d6361b0f0c55549aec89a7f6742/transformed/jetified-react-android-0.72.4-debug/prefab/modules/reactnativejni/libs/android.arm64-v8a/libreactnativejni.so /home/ubuntu/.gradle/caches/transforms-3/34c2120d0d3cd8dc97826fc02c9e8fc4/transformed/jetified-fbjni-0.3.0/prefab/modules/fbjni/libs/android.arm64-v8a/libfbjni.so /home/ubuntu/Android/Sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/aarch64-linux-android/21/liblog.so -landroid -latomic -lm && :
ld: error: undefined symbol: reanimated::extractWorkletRuntime(facebook::jsi::Runtime&, facebook::jsi::Value const&)
>>> referenced by FrameProcessorRuntimeManager.cpp:105 (/home/ubuntu/Documents/ReactNative/CameraTest/node_modules/react-native-vision-camera/android/src/main/cpp/FrameProcessorRuntimeManager.cpp:105)
>>> CMakeFiles/VisionCamera.dir/src/main/cpp/FrameProcessorRuntimeManager.cpp.o:(vision::FrameProcessorRuntimeManager::setFrameProcessor(facebook::jsi::Runtime&, int, facebook::jsi::Value const&, facebook::jsi::Value const&))
ld: error: undefined symbol: reanimated::extractShareableOrThrow(facebook::jsi::Runtime&, facebook::jsi::Value const&, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&)
>>> referenced by Shareables.h:163 (/home/ubuntu/Documents/ReactNative/CameraTest/node_modules/react-native-reanimated/android/build/prefab-headers/reanimated/Shareables.h:163)
>>> CMakeFiles/VisionCamera.dir/src/main/cpp/FrameProcessorRuntimeManager.cpp.o:(std::__ndk1::shared_ptr<reanimated::ShareableWorklet> reanimated::extractShareableOrThrow<reanimated::ShareableWorklet>(facebook::jsi::Runtime&, facebook::jsi::Value const&, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&))
ld: error: undefined symbol: typeinfo for reanimated::Shareable
>>> referenced by memory:0 (/home/ubuntu/Android/Sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/memory:0)
>>> CMakeFiles/VisionCamera.dir/src/main/cpp/FrameProcessorRuntimeManager.cpp.o:(std::__ndk1::enable_if<(!(is_array<reanimated::ShareableWorklet>::value)) && (!(is_array<reanimated::Shareable>::value)), std::__ndk1::shared_ptr<reanimated::ShareableWorklet> >::type std::__ndk1::dynamic_pointer_cast<reanimated::ShareableWorklet, reanimated::Shareable>(std::__ndk1::shared_ptr<reanimated::Shareable> const&))
>>> referenced by memory:0 (/home/ubuntu/Android/Sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/memory:0)
>>> CMakeFiles/VisionCamera.dir/src/main/cpp/FrameProcessorRuntimeManager.cpp.o:(std::__ndk1::enable_if<(!(is_array<reanimated::ShareableWorklet>::value)) && (!(is_array<reanimated::Shareable>::value)), std::__ndk1::shared_ptr<reanimated::ShareableWorklet> >::type std::__ndk1::dynamic_pointer_cast<reanimated::ShareableWorklet, reanimated::Shareable>(std::__ndk1::shared_ptr<reanimated::Shareable> const&))
ld: error: undefined symbol: typeinfo for reanimated::ShareableWorklet
>>> referenced by memory:0 (/home/ubuntu/Android/Sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/memory:0)
>>> CMakeFiles/VisionCamera.dir/src/main/cpp/FrameProcessorRuntimeManager.cpp.o:(std::__ndk1::enable_if<(!(is_array<reanimated::ShareableWorklet>::value)) && (!(is_array<reanimated::Shareable>::value)), std::__ndk1::shared_ptr<reanimated::ShareableWorklet> >::type std::__ndk1::dynamic_pointer_cast<reanimated::ShareableWorklet, reanimated::Shareable>(std::__ndk1::shared_ptr<reanimated::Shareable> const&))
>>> referenced by memory:0 (/home/ubuntu/Android/Sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/memory:0)
>>> CMakeFiles/VisionCamera.dir/src/main/cpp/FrameProcessorRuntimeManager.cpp.o:(std::__ndk1::enable_if<(!(is_array<reanimated::ShareableWorklet>::value)) && (!(is_array<reanimated::Shareable>::value)), std::__ndk1::shared_ptr<reanimated::ShareableWorklet> >::type std::__ndk1::dynamic_pointer_cast<reanimated::ShareableWorklet, reanimated::Shareable>(std::__ndk1::shared_ptr<reanimated::Shareable> const&))
clang-12: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
C++ build system [build] failed while executing:
/home/ubuntu/Android/Sdk/cmake/3.22.1/bin/ninja \
-C \
/home/ubuntu/Documents/ReactNative/CameraTest/node_modules/react-native-vision-camera/android/.cxx/Debug/3r1h2y4e/arm64-v8a \
VisionCamera
from /home/ubuntu/Documents/ReactNative/CameraTest/node_modules/react-native-vision-camera/android
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1m 13s
Project dependencies
"dependencies": {
"react": "18.2.0",
"react-native": "0.72.4",
"react-native-reanimated": "software-mansion/react-native-reanimated#5b93afe19c5451f67c3667efe1b6497daff54d4a",
"react-native-vision-camera": "2.16.1",
"vision-camera-face-detector": "^0.1.8"
},
VisionCamera Version
2.16.1
Target platforms
Android
Operating system
Linux
Can you build the VisionCamera Example app?
Yes, I can successfully build the Example app here
Additional information
- I am using Expo
- I have enabled Frame Processors (react-native-worklets-core)
- 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 9 months ago
- Reactions: 4
- Comments: 52 (6 by maintainers)
This issue was resolved for me by deleting the
.gradle
folder from<NameOfProject>/android
and then running it again withyarn android
. Could you please try doing the same, @iliapnmrv @JmePaz ?For me Itās working on IOS and Android using this:
Create that patch and use patch-package:
I created a PR with the solution: https://github.com/mrousavy/react-native-vision-camera/pull/1835
It works fine on react-native-reanimated 3.5.1 and also on 3.5.3
Surprisingly, this morning, no more errors with v2.16.1. I couldnāt use v3 since Iām also using
vision-camera-ocr
which is not compatible withreact-native-vision-camera@3.0.0
.Not sure about what solved the issue, since Iāve done a lot of things: React native update to v0.72.4, Android studio update to Giraffe (I canāt believe Iām writing such a version name) + Invalidate cache + clean + rebuild project. But now it works. I still have to test my entire app to check if everything works correctly. Iāll keep you updated.
@denisbevilacqua Thank you! sorry for the late reply
For me, It is working with below versions
"react-native-vision-camera": "2.15.4", "react-native-reanimated": "3.5.0", "react-native": "0.72.4",
also i had to add
kotlinVersion = "1.6.20"
andminSdkVersion = 26
to android/build.gradle@denisbevilacqua Thank you so much, you saved my time!
.gradle
folder was the reasonI can confirm that it works but after
./gradlew clean
issue persists. Any solutions?RNVC v3 does not work with
vision-camera-code-scanner v2
I can confirm it does not work with a
minSdkVersion 24
and usinghermesEnabled=false
withnewArchEnabled=false
As @stealkiller06 says here I confirm even using āreact-nativeā: ā0.72.5ā, this solution works (tested in Android only)
Edit: To be able to build a release (APK/Bundle) I had the exact same issue, but digging I found this the one from May 4 at 5:29 and did changed only this step ./android/build.gradle
And my minSdkVersion is 21 as in React native Docs Awesome Project, and I donāt have hermesEnabled=false nor newArchEnabled=false
@stealkiller06 This is using Hermes correct?
@JmePaz If you are not upgraded yet to latest version of āreact-nativeā 0.72.x, then I might have a solution for you. There were some discussions where I had specific versions for vision-camera and vision-camera-code-scanner and reanimated v2 that worked perfectly for me but unfortunately I cant find it right now. There is an other discussion going around qr code scanning and somebody had an alternative: https://github.com/mrousavy/react-native-vision-camera/issues/1807#issuecomment-1722861098
@JmePaz If you are experiencing the original error, not what @stemyke mentioned, then this patch would not help you. We are still facing the original error too after cleaning the project. We always change the reanimated version to something else in package.json do an install again, and hit play again in Android Studio. This way the error usually goes away but not always unfortunately. Probably some path is missing from CMakeLists in VisionCamera or could not be resolved automatically in certain scenarios.
@JmePaz You just have to create a patches folder, in your projects root where
node_modules
are. Copy the mentioned contents in it to a file named:react-native-vision-camera+2.16.1.patch
react-native-vision-camera+2.16.1.patch
Install
patch-package
as a dev dependency with yarn or npm whichever one you use.Add this one to your package.json inside the scripts object:
"postinstall": "patch-package"
Run
npm install
oryarn install
, and then the patch will be applied.I am also facing the same issue, Sometimes it builds but after
./gradlew clean
it gives the:react-native-vision-camera:buildCMakeDebug[arm64-v8a]
error and does not build. hopefully this will be resolved soon@Skizu It looks like reanimated team released again a new version that you are using a few hours ago. It seems it again has the original problem by not finding the extractWorklets method, so I stick my package.json to āreact-native-reanimatedā: ā3.5.3ā. I am using Hermes by the way yes.
I solved this issue by changing the latest version of react-native-reanimated to just
"3.5.0"
.My full dependencies: ` ādependenciesā: {
} `
Same here on 3.0
Iām just stuck on the same error right now š¦