react-native-vision-camera: 🐛 Execution failed for task ':react-native-vision-camera:buildCMakeDebug[arm64-v8a]'
What were you trying to do?
Hello, I get this error when running the android build.
“react”: “18.1.0”, “react-native”: “0.70.3”, “react-native-reanimated”: “^2.11.0”
Steps I made:
rm node_modules npm install cd android ./gradlew clean cd … npm react-native run-android
Reproduceable Code
No response
What happened instead?
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
- What went wrong: Execution failed for task ‘:react-native-vision-camera:buildCMakeDebug[arm64-v8a]’.
Relevant log output
> Build command failed.
Error while executing process /Users/admin/Library/Android/sdk/cmake/3.18.1/bin/ninja with arguments {-C /Users/admin/Desktop/AwesomeProject/node_modules/react-native-vision-camera/android/.cxx/Debug/42l6f1n6/arm64-v8a VisionCamera}
ninja: Entering directory `/Users/admin/Desktop/AwesomeProject/node_modules/react-native-vision-camera/android/.cxx/Debug/42l6f1n6/arm64-v8a'
[1/10] Building CXX object CMakeFiles/VisionCamera.dir/src/main/cpp/VisionCameraScheduler.cpp.o
FAILED: CMakeFiles/VisionCamera.dir/src/main/cpp/VisionCameraScheduler.cpp.o
/Users/admin/Library/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ --target=aarch64-none-linux-android21 --gcc-toolchain=/Users/admin/Library/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64 --sysroot=/Users/admin/Library/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64/sysroot -DVisionCamera_EXPORTS -I../../../../build/fbjni-0.3.0-headers.jar -I../../../../build/third-party-ndk/boost -I../../../../build/third-party-ndk/double-conversion -I../../../../build/third-party-ndk/folly -I../../../../build/third-party-ndk/glog -I/Users/admin/Desktop/AwesomeProject/node_modules/react-native/React -I/Users/admin/Desktop/AwesomeProject/node_modules/react-native/React/Base -I/Users/admin/Desktop/AwesomeProject/node_modules/react-native/ReactAndroid/src/main/jni -I/Users/admin/Desktop/AwesomeProject/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/jni -I/Users/admin/Desktop/AwesomeProject/node_modules/react-native/ReactCommon -I/Users/admin/Desktop/AwesomeProject/node_modules/react-native/ReactCommon/callinvoker -I/Users/admin/Desktop/AwesomeProject/node_modules/react-native/ReactCommon/jsi -I/Users/admin/Desktop/AwesomeProject/node_modules/hermes-engine/android/include -I/Users/admin/Desktop/AwesomeProject/node_modules/react-native-reanimated/Common/cpp/headers/AnimatedSensor -I/Users/admin/Desktop/AwesomeProject/node_modules/react-native-reanimated/Common/cpp/headers/Tools -I/Users/admin/Desktop/AwesomeProject/node_modules/react-native-reanimated/Common/cpp/headers/SpecTools -I/Users/admin/Desktop/AwesomeProject/node_modules/react-native-reanimated/Common/cpp/headers/SharedItems -I/Users/admin/Desktop/AwesomeProject/node_modules/react-native-reanimated/Common/cpp/headers/Registries -I/Users/admin/Desktop/AwesomeProject/node_modules/react-native-reanimated/Common/cpp/headers/LayoutAnimations -I/Users/admin/Desktop/AwesomeProject/node_modules/react-native-reanimated/Common/cpp/hidden_headers -I../../../../src/main/cpp -I/Users/admin/Desktop/AwesomeProject/node_modules/react-native/sdks/hermes/API -I/Users/admin/Desktop/AwesomeProject/node_modules/react-native/sdks/hermes/public -DFOLLY_NO_CONFIG=1 -DFOLLY_HAVE_CLOCK_GETTIME=1 -DFOLLY_HAVE_MEMRCHR=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_MOBILE=1 -DON_ANDROID -DONANDROID -DFOR_HERMES=true -DJS_RUNTIME_HERMES=1 -O0 -fno-limit-debug-info -fPIC -std=gnu++14 -MD -MT CMakeFiles/VisionCamera.dir/src/main/cpp/VisionCameraScheduler.cpp.o -MF CMakeFiles/VisionCamera.dir/src/main/cpp/VisionCameraScheduler.cpp.o.d -o CMakeFiles/VisionCamera.dir/src/main/cpp/VisionCameraScheduler.cpp.o -c ../../../../src/main/cpp/VisionCameraScheduler.cpp
In file included from ../../../../src/main/cpp/VisionCameraScheduler.cpp:5:
../../../../src/main/cpp/VisionCameraScheduler.h:7:10: fatal error: 'Scheduler.h' file not found
#include "Scheduler.h"
^~~~~~~~~~~~~
1 error generated.
[2/10] Building CXX object CMakeFiles/VisionCamera.dir/src/main/cpp/java-bindings/JHashMap.cpp.o
[3/10] Building CXX object CMakeFiles/VisionCamera.dir/src/main/cpp/java-bindings/JFrameProcessorPlugin.cpp.o
[4/10] Building CXX object CMakeFiles/VisionCamera.dir/src/main/cpp/java-bindings/JImageProxy.cpp.o
[5/10] Building CXX object CMakeFiles/VisionCamera.dir/src/main/cpp/VisionCamera.cpp.o
FAILED: CMakeFiles/VisionCamera.dir/src/main/cpp/VisionCamera.cpp.o
/Users/admin/Library/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ --target=aarch64-none-linux-android21 --gcc-toolchain=/Users/admin/Library/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64 --sysroot=/Users/admin/Library/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64/sysroot -DVisionCamera_EXPORTS -I../../../../build/fbjni-0.3.0-headers.jar -I../../../../build/third-party-ndk/boost -I../../../../build/third-party-ndk/double-conversion -I../../../../build/third-party-ndk/folly -I../../../../build/third-party-ndk/glog -I/Users/admin/Desktop/AwesomeProject/node_modules/react-native/React -I/Users/admin/Desktop/AwesomeProject/node_modules/react-native/React/Base -I/Users/admin/Desktop/AwesomeProject/node_modules/react-native/ReactAndroid/src/main/jni -I/Users/admin/Desktop/AwesomeProject/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/jni -I/Users/admin/Desktop/AwesomeProject/node_modules/react-native/ReactCommon -I/Users/admin/Desktop/AwesomeProject/node_modules/react-native/ReactCommon/callinvoker -I/Users/admin/Desktop/AwesomeProject/node_modules/react-native/ReactCommon/jsi -I/Users/admin/Desktop/AwesomeProject/node_modules/hermes-engine/android/include -I/Users/admin/Desktop/AwesomeProject/node_modules/react-native-reanimated/Common/cpp/headers/AnimatedSensor -I/Users/admin/Desktop/AwesomeProject/node_modules/react-native-reanimated/Common/cpp/headers/Tools -I/Users/admin/Desktop/AwesomeProject/node_modules/react-native-reanimated/Common/cpp/headers/SpecTools -I/Users/admin/Desktop/AwesomeProject/node_modules/react-native-reanimated/Common/cpp/headers/SharedItems -I/Users/admin/Desktop/AwesomeProject/node_modules/react-native-reanimated/Common/cpp/headers/Registries -I/Users/admin/Desktop/AwesomeProject/node_modules/react-native-reanimated/Common/cpp/headers/LayoutAnimations -I/Users/admin/Desktop/AwesomeProject/node_modules/react-native-reanimated/Common/cpp/hidden_headers -I../../../../src/main/cpp -I/Users/admin/Desktop/AwesomeProject/node_modules/react-native/sdks/hermes/API -I/Users/admin/Desktop/AwesomeProject/node_modules/react-native/sdks/hermes/public -DFOLLY_NO_CONFIG=1 -DFOLLY_HAVE_CLOCK_GETTIME=1 -DFOLLY_HAVE_MEMRCHR=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_MOBILE=1 -DON_ANDROID -DONANDROID -DFOR_HERMES=true -DJS_RUNTIME_HERMES=1 -O0 -fno-limit-debug-info -fPIC -std=gnu++14 -MD -MT CMakeFiles/VisionCamera.dir/src/main/cpp/VisionCamera.cpp.o -MF CMakeFiles/VisionCamera.dir/src/main/cpp/VisionCamera.cpp.o.d -o CMakeFiles/VisionCamera.dir/src/main/cpp/VisionCamera.cpp.o -c ../../../../src/main/cpp/VisionCamera.cpp
In file included from ../../../../src/main/cpp/VisionCamera.cpp:3:
../../../../src/main/cpp/FrameProcessorRuntimeManager.h:13:10: fatal error: 'RuntimeManager.h' file not found
#include "RuntimeManager.h"
^~~~~~~~~~~~~~~~~~
1 error generated.
[6/10] Building CXX object CMakeFiles/VisionCamera.dir/src/main/cpp/FrameProcessorRuntimeManager.cpp.o
FAILED: CMakeFiles/VisionCamera.dir/src/main/cpp/FrameProcessorRuntimeManager.cpp.o
/Users/admin/Library/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ --target=aarch64-none-linux-android21 --gcc-toolchain=/Users/admin/Library/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64 --sysroot=/Users/admin/Library/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64/sysroot -DVisionCamera_EXPORTS -I../../../../build/fbjni-0.3.0-headers.jar -I../../../../build/third-party-ndk/boost -I../../../../build/third-party-ndk/double-conversion -I../../../../build/third-party-ndk/folly -I../../../../build/third-party-ndk/glog -I/Users/admin/Desktop/AwesomeProject/node_modules/react-native/React -I/Users/admin/Desktop/AwesomeProject/node_modules/react-native/React/Base -I/Users/admin/Desktop/AwesomeProject/node_modules/react-native/ReactAndroid/src/main/jni -I/Users/admin/Desktop/AwesomeProject/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/jni -I/Users/admin/Desktop/AwesomeProject/node_modules/react-native/ReactCommon -I/Users/admin/Desktop/AwesomeProject/node_modules/react-native/ReactCommon/callinvoker -I/Users/admin/Desktop/AwesomeProject/node_modules/react-native/ReactCommon/jsi -I/Users/admin/Desktop/AwesomeProject/node_modules/hermes-engine/android/include -I/Users/admin/Desktop/AwesomeProject/node_modules/react-native-reanimated/Common/cpp/headers/AnimatedSensor -I/Users/admin/Desktop/AwesomeProject/node_modules/react-native-reanimated/Common/cpp/headers/Tools -I/Users/admin/Desktop/AwesomeProject/node_modules/react-native-reanimated/Common/cpp/headers/SpecTools -I/Users/admin/Desktop/AwesomeProject/node_modules/react-native-reanimated/Common/cpp/headers/SharedItems -I/Users/admin/Desktop/AwesomeProject/node_modules/react-native-reanimated/Common/cpp/headers/Registries -I/Users/admin/Desktop/AwesomeProject/node_modules/react-native-reanimated/Common/cpp/headers/LayoutAnimations -I/Users/admin/Desktop/AwesomeProject/node_modules/react-native-reanimated/Common/cpp/hidden_headers -I../../../../src/main/cpp -I/Users/admin/Desktop/AwesomeProject/node_modules/react-native/sdks/hermes/API -I/Users/admin/Desktop/AwesomeProject/node_modules/react-native/sdks/hermes/public -DFOLLY_NO_CONFIG=1 -DFOLLY_HAVE_CLOCK_GETTIME=1 -DFOLLY_HAVE_MEMRCHR=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_MOBILE=1 -DON_ANDROID -DONANDROID -DFOR_HERMES=true -DJS_RUNTIME_HERMES=1 -O0 -fno-limit-debug-info -fPIC -std=gnu++14 -MD -MT CMakeFiles/VisionCamera.dir/src/main/cpp/FrameProcessorRuntimeManager.cpp.o -MF CMakeFiles/VisionCamera.dir/src/main/cpp/FrameProcessorRuntimeManager.cpp.o.d -o CMakeFiles/VisionCamera.dir/src/main/cpp/FrameProcessorRuntimeManager.cpp.o -c ../../../../src/main/cpp/FrameProcessorRuntimeManager.cpp
In file included from ../../../../src/main/cpp/FrameProcessorRuntimeManager.cpp:5:
../../../../src/main/cpp/FrameProcessorRuntimeManager.h:13:10: fatal error: 'RuntimeManager.h' file not found
#include "RuntimeManager.h"
^~~~~~~~~~~~~~~~~~
1 error generated.
[7/10] Building CXX object CMakeFiles/VisionCamera.dir/src/main/cpp/FrameHostObject.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
ninja: build stopped: subcommand failed.
Device
Samsung S22
VisionCamera Version
2.14.1
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: 30
- Comments: 80 (4 by maintainers)
Fixed downgrading react-native-reanimated from 2.11.0 to 2.10.0
I had to do
on a mac M1 to fix this issue.
We realized the cmake command was returning an error stating “bad CPU” Try:
Make sure your command with cmake and the corresponding version does not throw an error.
Thanks to @edwinw6 !
cd android => ./gradlew clean delete node_module “react-native-reanimated”: “2.10.0”, for “react-native-vision-camera”: “2.14.1”, if you have ‘^’ this sign with versions remove it first yarn / npm i
Same issue, has this been fixed?
I fixed it by following the below steps 😃
yeah! i confirm this solution, because I faced the issue and i fixed by use it
you should use “react-native-reanimated”: “2.10.0”, for “react-native-vision-camera”: “2.14.1”,
remember, remove node_modules and gradlew clean, and then run yarn android
wish successful for you !
My error is below
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use ‘–warning-mode all’ to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.5.1/userguide/command_line_interface.html#sec:command_line_warnings 280 actionable tasks: 8 executed, 272 up-to-date
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
2: Task failed with an exception.
What went wrong: java.lang.StackOverflowError (no error message)
Try:
BUILD FAILED in 28s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
2: Task failed with an exception.
What went wrong: java.lang.StackOverflowError (no error message)
Try:
BUILD FAILED in 28s
info Run CLI with --verbose flag for more details. error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
versions I use :— “react”: “18.1.0”, “react-native”: “0.70.0”, “react-native-vision-camera”: “^2.14.1”, “vision-camera-code-scanner”: “^0.2.0”, “vision-camera-face-detector”: “^0.1.8”, “vision-camera-object-detection”: “^0.1.6” “react-native-reanimated”: “^2.10.0”,
Hello there ! My first post ever. Found a possible solution for some user’s. Short story: Tried everything here… Nothing worked. My colleague and I got the same error, while colleagues that tested building on theirs had no issues. Anyways. The way I fixed it for my colleague and me was by this order.
1)Open your project in Android Studio. ( wait for him to index the project etc) 2)Open File -> Settings -> search Android SDK -> under Android SDK pick SDK Tools uninstall all NDK extensions you have installed , then uninstall all CMake extensions you have installed By uninstalling I mean, uncheck boxes from all versions, press Apply then Ok. 3)After that open settings again and install version NDK 25.08775105 and CMake 3.22.1 Check those two boxes Apply -> Ok
4) File -> Invalidate Caches -> check both boxes, invalidate and restart 5) No matter if you build on Virutal or Physical device app, uninstall the app from mobile before building project 6)Build && #pray
Optional 6*) I recommend to do that on freshly cloned project, or if you do not use git/bitbucket… only local -> delete/install modules
If you need my versions “react”: “18.1.0” “react-native”: “0.70.3” “react-native-reanimated”: “^2.11.0” “react-native-vision-camera”: “^2.15.2” “vision-camera-code-scanner”: “^0.2.0”
android/build.gradle
buildscript { ext { googlePlayServicesVersion = ‘18.0.0’ firebaseMessagingVersion = ‘21.1.0’
oh wait, it didn’t
A Workaround for those who gets this issue,
Downgrade react-native-reanimated 2.10.0
I found workaround for my project. I don’t need frame processors, but my project contains
react-native-reanimated
for some other features. So I just addeddisableFrameProcessors=true
line togradle.properties
file in my project and everything works good now.I also had to implement the solution from this post https://stackoverflow.com/a/74342523/3763750 and after that it started working again 🎉
instead, the app crashes before starting without throwing any errors
I’ve made a new PR that fixes this issue for newer version of
react-native-reanimated
, so it is up to maintainer now.Option 1 : delete node_modules edit package.json “react”: “^18.2.0”, “react-native”: “^0.70.3”, “react-native-reanimated”: “2.10.0”, #not using “^2.10.0” “react-native-vision-camera”: “^2.14.1”,
watchman watch-del-all yarn cache clean --force yarn install //// check node_modules/Common/headers does it exist? if exist next not exist Op 2 /// cd android => ./gradlew clean yarn android Option 2 : cd node_modules/react-native-vision-camera/android edit CMakeLists.txt find “${NODE_MODULES_DIR}/react-native-reanimated/Common/cpp/headers/AnimatedSensor” “${NODE_MODULES_DIR}/react-native-reanimated/Common/cpp/headers/Tools” “${NODE_MODULES_DIR}/react-native-reanimated/Common/cpp/headers/SpecTools” “${NODE_MODULES_DIR}/react-native-reanimated/Common/cpp/headers/SharedItems” “${NODE_MODULES_DIR}/react-native-reanimated/Common/cpp/headers/Registries” “${NODE_MODULES_DIR}/react-native-reanimated/Common/cpp/headers/LayoutAnimations”
edit “${NODE_MODULES_DIR}/react-native-reanimated/Common/cpp/AnimatedSensor” “${NODE_MODULES_DIR}/react-native-reanimated/Common/cpp/Tools” “${NODE_MODULES_DIR}/react-native-reanimated/Common/cpp/SpecTools” “${NODE_MODULES_DIR}/react-native-reanimated/Common/cpp/SharedItems” “${NODE_MODULES_DIR}/react-native-reanimated/Common/cpp/Registries” “${NODE_MODULES_DIR}/react-native-reanimated/Common/cpp/LayoutAnimations”
@Fari056 solution worked for me =]
“react”: “^18.2.0”, “react-native”: “^0.70.1”, “react-native-reanimated”: “2.10.0”, “react-native-vision-camera”: “2.14.1”,
that fixed my issue too
Hey! I’ve rewritten the entire Android codebase of VisionCamera from CameraX to Camera2 in the efforts of ✨ VisionCamera V3.
I just now completed the Camera2 rewrite and I believe the core structure is running, but there might be some edge cases to iron out. Can you try and test the PR #1674 for me to see if you can still reproduce this issue here?
Here’s an instruction on how you can test that: https://github.com/mrousavy/react-native-vision-camera/pull/1674#issuecomment-1684104217
If the issue cannot be reproduced with that version/PR anymore, then hoorayy, I fixed it! 🎉 Otherwise please let me know and I’ll keep this issue open to keep track of it.
Thank you!
This is how I fixed it:
The problem was a missing directory called
boost
in./node_modules/react-native-vision-camera/android/build/third-party-ndk/folly
, so I searched for the boost version in my project, with for example:Which gave:
Then on this page https://www.boost.org/users/history/ I downloaded the right version, for my case it was
1.76.0
, I decompressed the file, then I copied the directory./boost
to./node_modules/react-native-vision-camera/android/build/third-party-ndk/folly
.Now it works.
react-native-vision-camera 2.15.0 react-native-reanimated 2.11.0 ==> same issue
@wasiquehaider @thuantvDr4 @ikuruzum hi ,It didn’t work, the same error still . which verson of react native ?
Indeed, downgrading
react-native-reanimated
from2.11.0
to2.10.0
fixed issue for me. I got MacBook Pro with M1 Pro chip. Thanks. dudecc: @scaralfred
@GeandersonTodimo Indeed you are right, that seems to be the root of the issue
One not-so-great alternative is to fall back to the package that sent most of us here (react-native-camera) It sure needs a few tweaks with patch-package but if anyone is in a rush to get a scanner working I believe that’s one way to go about it 😕
Thank you guys so much for posting this issue, I just ran into it on a brand new react-native (0.70.3) project with nothing else installed besides this and it’s dependencies.
@Jaybee4real I’ll give your comment a try in a sec and I’ll confirm if it works for anyone else having this issue
Thanks again, let’s keep us posted about any updates on this thread!
Me too had the same issue.
Gradle 7.5.1
Build time: 2022-08-05 21:17:56 UTC Revision: d1daa0cbf1a0103000b71484e1dbfe096e095918
Kotlin: 1.6.21 Groovy: 3.0.10 Ant: Apache Ant™ version 1.10.11 compiled on July 10 2021 JVM: 11.0.12 (Oracle Corporation 11.0.12+8-LTS-237) OS: Windows 10 10.0 amd64
“react”: “18.1.0”, “react-native”: “0.70.3”, “react-native-hole-view”: “^2.1.2”, “react-native-reanimated”: “2.10.0”, “react-native-svg”: “^13.4.0”, “react-native-vision-camera”: “^2.14.1”, “vision-camera-code-scanner”: “^0.2.0”
I had ran the follows commands inside folder android: 1º ./gradlew clean 2º ./gradlew.bat installDebug --warning-mode all 3º cd … npx react-native run-android.
But it delayed so mush time and I always have to do the same because occur the problem frequently.
It works for me by removing and adding it again:
I’m using version 2.10.0 is much more stable. Sometimes you’ll need to run a few 2 or 3 times and clean the Gradle cache to work, but, it is more stable than others.
As was suggested above, downgrading to 2.10.0 without the “^” solved the problem for me
Nothing they say solves the problem, I don’t think the solution has to be to use a deprecated library like react-native-camera