Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🔧 V2.16.1 and react-native 0.72.4 android Execution failed for task ':react-native-vision-camera:buildCMakeDebug[arm64-v8a]'. #1814

Closed
3 of 5 tasks
webhibegit opened this issue Sep 19, 2023 · 53 comments
Labels
🔧 build error Issue is related to building VisionCamera in your project

Comments

@webhibegit
Copy link

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

@webhibegit webhibegit added the 🔧 build error Issue is related to building VisionCamera in your project label Sep 19, 2023
@tezqa
Copy link

tezqa commented Sep 19, 2023

I'm just stuck on the same error right now :(

@tezqa
Copy link

tezqa commented Sep 19, 2023

downgrade version to 2.16.1 i have a same version as 0.72.4

2.16.1?
@webhibegit is already using this version, and I'm using the 2.16.0.

@mrousavy mrousavy changed the title V2.16.1 and react-native 0.72.4 android Execution failed for task ':react-native-vision-camera:buildCMakeDebug[arm64-v8a]'. 🔧 🔧 V2.16.1 and react-native 0.72.4 android Execution failed for task ':react-native-vision-camera:buildCMakeDebug[arm64-v8a]'. Sep 19, 2023
@DavideSegullo
Copy link

I have the same error too:

  • react-native-vision-camera 2.16.1
  • react-native 0.72.3
  • react-native-reanimated 3.5.2

@jonixj
Copy link

jonixj commented Sep 19, 2023

Same here on 3.0

@WanderingBit
Copy link

I tried building the project with both CMake versions 3.22.1 and 3.18.1 individually, but the problem persisted. The error did change with version 3.22.1. However, I was able to build using CMake version 3.18 when the frame processor was disabled.

@webhibegit
Copy link
Author

Can we use react-native-worklets-core in V2.16.1? In v3 this solution is working. So could we use react-native-worklets-core in v2.16.1 also?

@tezqa
Copy link

tezqa commented Sep 20, 2023

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 with react-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.

@JmePaz
Copy link

JmePaz commented Sep 21, 2023

I solved this issue by changing the latest version of react-native-reanimated to just "3.5.0".

My full dependencies:
`
"dependencies": {

  • "react": "18.2.0",
    
  • "react-native": "0.72.4",
    
  • "react-native-vision-camera": "^2.16.1",
    
  • "react-native-worklets-core": "^0.2.0",
    
  • "string-hash-64": "^1.0.3",
    
  • "react-native-reanimated": "3.5.0"
    

    }
    `

@tezqa
Copy link

tezqa commented Sep 21, 2023

I confirm I'm using react-native-reanimated@3.5.0 but it was already the case when I had issues.

I've also applied this patch to react-native-vision-camera@2.16.1 to get it working:

diff --git a/node_modules/react-native-vision-camera/android/build.gradle b/node_modules/react-native-vision-camera/android/build.gradle
index 9b14ec7..3fd5ab3 100644
--- a/node_modules/react-native-vision-camera/android/build.gradle
+++ b/node_modules/react-native-vision-camera/android/build.gradle
@@ -90,7 +90,6 @@ buildscript {
 apply plugin: 'com.android.library'
 apply plugin: 'de.undercouch.download'
 apply plugin: 'kotlin-android'
-apply plugin: 'kotlin-android-extensions'
 
 def getExtOrDefault(name) {
   return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['VisionCamera_' + name]

@DavideSegullo
Copy link

DavideSegullo commented Sep 21, 2023

I have the same error too:

  • react-native-vision-camera 2.16.1
  • react-native 0.72.3
  • react-native-reanimated 3.5.2

It works fine on react-native-reanimated 3.5.1 and also on 3.5.3

@stemyke
Copy link

stemyke commented Sep 21, 2023

@mrousavy Sorry for pinging you here, I tried the versions today whet @DavideSegullo suggested, but I have an other problem. It says:

[CXX1214] D:\Work\rnea\node_modules\react-native-vision-camera\android\CMakeLists.txt debug|x86 : User has minSdkVersion 21 but library was built for 26 [//react-native-reanimated/reanimated]
Affected Modules: react-native-vision-camera

Do you have any idea what could be the problem? I checked everything where minSdk can be set and I am sure I set 26 everywhere possible. After cleaning rebuilding the project it still does not work.

@DavideSegullo
Copy link

@mrousavy Sorry for pinging you here, I tried the versions today whet @DavideSegullo suggested, but I have an other problem. It says:

[CXX1214] D:\Work\rnea\node_modules\react-native-vision-camera\android\CMakeLists.txt debug|x86 : User has minSdkVersion 21 but library was built for 26 [//react-native-reanimated/reanimated]
Affected Modules: react-native-vision-camera

Do you have any idea what could be the problem? I checked everything where minSdk can be set and I am sure I set 26 everywhere possible. After cleaning rebuilding the project it still does not work.

can you reproduce it in a repo?

@Skizu
Copy link

Skizu commented Sep 21, 2023

@mrousavy Sorry for pinging you here, I tried the versions today whet @DavideSegullo suggested, but I have an other problem. It says:

[CXX1214] D:\Work\rnea\node_modules\react-native-vision-camera\android\CMakeLists.txt debug|x86 : User has minSdkVersion 21 but library was built for 26 [//react-native-reanimated/reanimated]
Affected Modules: react-native-vision-camera

Do you have any idea what could be the problem? I checked everything where minSdk can be set and I am sure I set 26 everywhere possible. After cleaning rebuilding the project it still does not work.

This is a result of react-native-vision-camera having a hard reference to minSdkVersion 21 instead of using something like minSdkVersion getExtOrIntegerDefault('minSdkVersion') akin to react-native-reanimated. As such I assume your applications minSdkVersion is 26.

@stemyke
Copy link

stemyke commented Sep 21, 2023

@Skizu Yes my minSdkVersion is set to 26. Can I change it somehow for me in vision-camera code? Or should I just revert it back to 21 and it will work? If I remember well Marc written somewhere that it should be set to 26. Maybe it was only for v3.. I cant tell.

@Skizu
Copy link

Skizu commented Sep 21, 2023

You can make a patch for react-native-vision-camera's build.gradle where you replace the line minSdkVersion 21 with minSdkVersion getExtOrIntegerDefault('minSdkVersion'). After this your project, react-native-vision-camera, and react-native-reanimated will use the same versions.

Currently react-native-vision-camera does not have a fix for this or for building for anything except hermes.

@stemyke
Copy link

stemyke commented Sep 21, 2023

@Skizu Thank you very much it is finally building with this patch 🙂

@Skizu
Copy link

Skizu commented Sep 21, 2023

@stemyke are you building for hermes? What versions are you using? I am still unable to build Release APKs or Bundles for JSC using the below versions with patches to minSdkVersion and FOR_HERMES in build.gradle.

    "react-native": "0.72.4",
    "react-native-reanimated": "^3.5.4",
    "react-native-vision-camera": "2.16.1",

@stemyke
Copy link

stemyke commented Sep 21, 2023

@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.

@stemyke
Copy link

stemyke commented Sep 21, 2023

@Skizu For now I am stuck again with an other problem. If I attach a frame processor to my camera then the app is frozen complately. Even if it just contains a simple console.log

const frameProcessor = useFrameProcessor(
        frame => {
            'worklet';
            console.log(frame.toString());
        },
        [],
    );
    

@WanderingBit
Copy link

@Skizu For now I am stuck again with an other problem. If I attach a frame processor to my camera then the app is frozen complately. Even if it just contains a simple console.log

const frameProcessor = useFrameProcessor(
        frame => {
            'worklet';
            console.log(frame.toString());
        },
        [],
    );
    

Of course, you shouldn't parse the frame as a string at the maximum refresh rate. That's completely normal.

@stemyke
Copy link

stemyke commented Sep 21, 2023

@WanderingBit Why would it be normal? The toString() method generally just printing out the frame's width and height. Even if I set frameProcessorFps to 1 which is by Marcs saying is the default value actually it still does not work.

@JmePaz
Copy link

JmePaz commented Sep 21, 2023

My solution did not unfortunately work. I am confused. Because sometimes it build successful unexpectedly (with frame processor enabled), and most of the time it does not work and produced this kind of error. TBH I do not know the reason why this happen. tried a bunch of things, hopefully this will be resolved soon.

@rizshivalli
Copy link

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

@KarlosQ
Copy link

KarlosQ commented Sep 22, 2023

@mrousavy Sorry for pinging you here, I tried the versions today whet @DavideSegullo suggested, but I have an other problem. It says:

[CXX1214] D:\Work\rnea\node_modules\react-native-vision-camera\android\CMakeLists.txt debug|x86 : User has minSdkVersion 21 but library was built for 26 [//react-native-reanimated/reanimated]
Affected Modules: react-native-vision-camera

Do you have any idea what could be the problem? I checked everything where minSdk can be set and I am sure I set 26 everywhere possible. After cleaning rebuilding the project it still does not work.

Create that patch and use patch-package:

diff --git a/node_modules/react-native-vision-camera/android/build.gradle b/node_modules/react-native-vision-camera/android/build.gradle
index d308e15..e1d9dd9 100644
--- a/node_modules/react-native-vision-camera/android/build.gradle
+++ b/node_modules/react-native-vision-camera/android/build.gradle
@@ -135,7 +135,7 @@ android {
   }
 
   defaultConfig {
-    minSdkVersion 21
+    minSdkVersion getExtOrIntegerDefault('minSdkVersion')
     targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
 
     if (ENABLE_FRAME_PROCESSORS) {

I created a PR with the solution:
#1835

@JmePaz
Copy link

JmePaz commented Sep 22, 2023

Hello @KarlosQ I am new to this, how do you create a patch and use that patch package?

@metrix-hu
Copy link
Contributor

metrix-hu commented Sep 22, 2023

@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 or yarn install, and then the patch will be applied.

@JmePaz
Copy link

JmePaz commented Sep 22, 2023

Unfortunately it does not works for me :( .

@metrix-hu
Copy link
Contributor

metrix-hu commented Sep 22, 2023

@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
Copy link

JmePaz commented Sep 22, 2023

@metrix-hu True, Unfortunately I am trying everything I can HUHUHHUHH straight for two days but nothing works. It looks like I had to give up using this module/package for now. Any recommendation for alternative package/module. I am building a qr scanner app. (Any recommendation would be appreciated thank you).

@metrix-hu
Copy link
Contributor

@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: #1807 (comment)

@stealkiller06
Copy link

For me It's working on IOS and Android using this:

   "react-native": "0.72.4",
  "react-native-reanimated": "3.5.2",
   "react-native-vision-camera": "2.16.1",
   "vision-camera-code-scanner": "^0.2.0",

@JmePaz
Copy link

JmePaz commented Sep 22, 2023

@stealkiller06 May I ask if After cleaning the gradle, does it still work?

@rizshivalli
Copy link

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" and minSdkVersion = 26 to android/build.gradle

@Skizu
Copy link

Skizu commented Sep 27, 2023

Bump

@Skizu
Copy link

Skizu commented Sep 28, 2023

For me It's working on IOS and Android using this:

   "react-native": "0.72.4",
   "react-native-reanimated": "3.5.2",
   "react-native-vision-camera": "2.16.1",
   "vision-camera-code-scanner": "^0.2.0",

@stealkiller06 This is using Hermes correct?

@mrousavy
Copy link
Owner

Hey! I think this should be fixed in the latest release, no?

@Skizu
Copy link

Skizu commented Oct 1, 2023 via email

@mmo-uy
Copy link

mmo-uy commented Oct 2, 2023

For me It's working on IOS and Android using this:

   "react-native": "0.72.4",
  "react-native-reanimated": "3.5.2",
   "react-native-vision-camera": "2.16.1",
   "vision-camera-code-scanner": "^0.2.0",

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

@Skizu
Copy link

Skizu commented Oct 2, 2023

I can confirm it does not work with a minSdkVersion 24 and using hermesEnabled=false with newArchEnabled=false

For me It's working on IOS and Android using this:

   "react-native": "0.72.4",
  "react-native-reanimated": "3.5.2",
   "react-native-vision-camera": "2.16.1",
   "vision-camera-code-scanner": "^0.2.0",

As @stealkiller06 says here I confirm even using "react-native": "0.72.5", this solution works (tested in Android only)

@pepperav
Copy link

pepperav commented Oct 2, 2023

I have same issue after updating react-native-vision-camera from 3.1.0 to 3.2.2.

package.json

"dependencies": {
    "@types/react": "~18.2.14",
    "expo": "~49.0.12",
    "expo-dev-client": "~2.4.11",
    "expo-splash-screen": "~0.20.5",
    "expo-status-bar": "~1.6.0",
    "react": "18.2.0",
    "react-native": "0.72.5",
    "react-native-vision-camera": "^3.1.0",
    "react-native-worklets-core": "^0.2.0",
    "typescript": "^5.1.3"
  }

@iliapnmrv
Copy link

For me It's working on IOS and Android using this:

   "react-native": "0.72.4",
  "react-native-reanimated": "3.5.2",
   "react-native-vision-camera": "2.16.1",
   "vision-camera-code-scanner": "^0.2.0",

I can confirm that it works but after ./gradlew clean issue persists. Any solutions?

RNVC v3 does not work with vision-camera-code-scanner v2

@denisbevilacqua
Copy link

denisbevilacqua commented Oct 3, 2023

This issue was resolved for me by deleting the .gradle folder from <NameOfProject>/android and then running it again with yarn android. Could you please try doing the same, @iliapnmrv @JmePaz ?

@iliapnmrv
Copy link

iliapnmrv commented Oct 3, 2023

@denisbevilacqua Thank you so much, you saved my time! .gradle folder was the reason

@JmePaz
Copy link

JmePaz commented Nov 3, 2023

@denisbevilacqua Thank you! sorry for the late reply

@pasquale95
Copy link

Hi everyone,
does anyone know what is the reason of this weird behaviour? As soon as I run ./gradlew clean, ./gradlew assembleDebug stops working.
I am using the following setup:

"react-native": "0.72.6",
"react-native-reanimated": "3.5.4",
"react-native-vision-camera": "2.16.5",
"vision-camera-code-scanner": "^0.2.0",

To solve the issue I must delete .gradle and rerun ./gradlew assembleDebug command.
I must add that the same exact procedure must be done also to run ./gradlew assembleRelease successfully.

@LuizCristino
Copy link

For me It's working on IOS and Android using this:

   "react-native": "0.72.4",
  "react-native-reanimated": "3.5.2",
   "react-native-vision-camera": "2.16.1",
   "vision-camera-code-scanner": "^0.2.0",

I can confirm that it works but after ./gradlew clean issue persists. Any solutions?

RNVC v3 does not work with vision-camera-code-scanner v2

If you upgrade to RNVC v3 you don't need vision-camera-code-scanner no more. You can follow this guide on their own docs. Also don't forget to install the worklets (this package react-native-worklets-core).
https://react-native-vision-camera.com/docs/guides/code-scanning

@mrousavy
Copy link
Owner

You don't need Worklets for the simple CodeScanning.

@AamenaSaiyed
Copy link

Hey I am facing that header issue but not find any issue can anyone help me over it??
Screenshot 2024-01-19 at 6 27 30 PM

Screenshot 2024-01-19 at 6 27 54 PM

Screenshot 2024-01-19 at 6 28 08 PM

This is from android studio build log box

@Pablo-DiazTassara
Copy link

Pablo-DiazTassara commented Jan 31, 2024

Hi, what worked for me was updating react-native-worklets-core to 0.3.0.
And update Gradle to 8.2.
Delete the node_module folder, the yarn.lock and install everything again. Then I cleared metro cache and run gradle clean.
I don't use the react-native-reanimated library

"react-native-vision-camera": "^3.8.2",
"react-native-worklets-core": "^0.3.0",
"react": "18.2.0",
"react-native": "^0.72.0",

buildToolsVersion="33.0.0"
minSdkVersion = 26
compileSdkVersion = 33
targetSdkVersion = 34
ndkVersion="20.1.5948944"

@mrousavy
Copy link
Owner

Great to hear! 👍

@facucalle92
Copy link

Maybe for someone who is not being able to solve it, you can try reinstalling the NDK from Android Studio.
I got the solution for a similar issue here: software-mansion/react-native-reanimated#4241 (comment)

@NoahSimajji
Copy link

Hi there, any solution for this? So i have to remove the .gradle every time after i ./gradlew clean?

@francesco-clementi-92
Copy link

francesco-clementi-92 commented Jun 21, 2024

I have the same problem and deleting the .gradle fix it, but I need to do it everytime. I could help also on debugging the problem, but I don't even know where to start. Any help is appreciated.
This is my setup:

"react-native-vision-camera": "4.3.2",
"react-native-worklets-core": "^1.3.3",
"vision-camera-ocr-plugin": "^3.0.9"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔧 build error Issue is related to building VisionCamera in your project
Projects
None yet
Development

No branches or pull requests