skip to Main Content

I get this build error and i have no idea how to resolve it. Help?

BUILD FAILED in 58s error Failed to install the app. Command failed with exit code 1: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081 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 C:UserswillmOneDriveDocumentsNew foldernode_modulesreact-native-vision-cameraandroid.cxxDebug5a2g3g6parm64-v8a’ [1/1] Linking CXX shared library ……..buildintermediatescxxDebug5a2g3g6pobjarm64-v8alibVisionCamera.so FAILED: ../../../../build/intermediates/cxx/Debug/5a2g3g6p/obj/arm64-v8a/libVisionCamera.so cmd.exe /C "cd . && C:UserswillmAppDataLocalAndroidSdkndk25.1.8937393toolchainsllvmprebuiltwindows-x86_64binclang++.exe –target=aarch64-none-linux-android21 –sysroot=C:/Users/willm/AppData/Local/Android/Sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/windows-x86_64/sysroot -fPIC -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -O2 -frtti -fexceptions -Wall -Wno-unused-variable -fstack-protector-all -fno-limit-debug-info -Wl,–build-id=sha1 -Wl,–no-rosegment -Wl,–fatal-warnings -Wl,–gc-sections -Wl,–no-undefined -Qunused-arguments -shared -Wl,-soname,libVisionCamera.so -o ……..buildintermediatescxxDebug5a2g3g6pobjarm64-v8alibVisionCamera.so CMakeFiles/VisionCamera.dir/bbd5bb5eb92bb6b1c1a66f08d454c6a9/react-native-vision-camera/cpp/MutableRawBuffer.cpp.o CMakeFiles/VisionCamera.dir/src/main/cpp/VisionCamera.cpp.o CMakeFiles/VisionCamera.dir/src/main/cpp/VideoPipeline.cpp.o CMakeFiles/VisionCamera.dir/src/main/cpp/PassThroughShader.cpp.o CMakeFiles/VisionCamera.dir/src/main/cpp/OpenGLContext.cpp.o CMakeFiles/VisionCamera.dir/src/main/cpp/OpenGLRenderer.cpp.o CMakeFiles/VisionCamera.dir/src/main/cpp/MutableJByteBuffer.cpp.o CMakeFiles/VisionCamera.dir/src/main/cpp/frameprocessor/FrameHostObject.cpp.o CMakeFiles/VisionCamera.dir/src/main/cpp/frameprocessor/FrameProcessorPluginHostObject.cpp.o CMakeFiles/VisionCamera.dir/src/main/cpp/frameprocessor/JSIJNIConversion.cpp.o CMakeFiles/VisionCamera.dir/src/main/cpp/frameprocessor/VisionCameraProxy.cpp.o CMakeFiles/VisionCamera.dir/src/main/cpp/frameprocessor/java-bindings/JSharedArray.cpp.o CMakeFiles/VisionCamera.dir/src/main/cpp/frameprocessor/java-bindings/JFrame.cpp.o CMakeFiles/VisionCamera.dir/src/main/cpp/frameprocessor/java-bindings/JFrameProcessor.cpp.o CMakeFiles/VisionCamera.dir/src/main/cpp/frameprocessor/java-bindings/JFrameProcessorPlugin.cpp.o CMakeFiles/VisionCamera.dir/src/main/cpp/frameprocessor/java-bindings/JVisionCameraProxy.cpp.o CMakeFiles/VisionCamera.dir/src/main/cpp/frameprocessor/java-bindings/JVisionCameraScheduler.cpp.o C:/Users/willm/AppData/Local/Android/Sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/lib/aarch64-linux-android/21/liblog.so -landroid C:/Users/willm/.gradle/caches/transforms-3/b4db2f23f2ab214a51186ce21dfe946e/transformed/jetified-react-android-0.73.4-debug/prefab/modules/jsi/libs/android.arm64-v8a/libjsi.so C:/Users/willm/.gradle/caches/transforms-3/b4db2f23f2ab214a51186ce21dfe946e/transformed/jetified-react-android-0.73.4-debug/prefab/modules/reactnativejni/libs/android.arm64-v8a/libreactnativejni.so C:/Users/willm/.gradle/caches/transforms-3/057fda56c2cfc52d70a46042a30c6944/transformed/jetified-fbjni-0.5.1/prefab/modules/fbjni/libs/android.arm64-v8a/libfbjni.so -lGLESv2 -lEGL -latomic -lm && cd ." ld: error: undefined symbol: RNWorklet::JsiWorkletContext::getWorkletRuntime() >>> referenced by JVisionCameraProxy.h:42 (C:/Users/willm/OneDrive/Documents/New folder/node_modules/react-native-vision-camera/android/src/main/cpp/frameprocessor/java-bindings/JVisionCameraProxy.h:42) >>> CMakeFiles/VisionCamera.dir/src/main/cpp/frameprocessor/java-bindings/JSharedArray.cpp.o:(vision::JSharedArray::JSharedArray(facebook::jni::alias_ref<facebook::jni::detail::JTypeFor<facebook::jni::HybridClass<vision::JSharedArray, facebook::jni::detail::BaseHybridClass>::JavaPart, facebook::jni::JObject, void>::_javaobject*> const&, facebook::jni::alias_ref<facebook::jni::detail::JTypeFor<facebook::jni::HybridClass<vision::JVisionCameraProxy, facebook::jni::detail::BaseHybridClass>::JavaPart, facebook::jni::JObject, void>::_javaobject*> const&, facebook::jni::alias_reffacebook::jni::JByteBuffer)) >>> referenced by JFrameProcessor.cpp:37 (C:/Users/willm/OneDrive/Documents/New folder/node_modules/react-native-vision-camera/android/src/main/cpp/frameprocessor/java-bindings/JFrameProcessor.cpp:37) >>> CMakeFiles/VisionCamera.dir/src/main/cpp/frameprocessor/java-bindings/JFrameProcessor.cpp.o:(vision::JFrameProcessor::callWithFrameHostObject(std::__ndk1::shared_ptrvision::FrameHostObject const&) const) ld: error: undefined symbol: RNWorklet::JsiWorkletContext::runtimeMappings >>> referenced by __tree:0 (C:/Users/willm/AppData/Local/Android/Sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/c++/v1/__tree:0) >>> CMakeFiles/VisionCamera.dir/src/main/cpp/frameprocessor/java-bindings/JFrameProcessor.cpp.o:(RNWorklet::WorkletInvoker::call(facebook::jsi::Runtime&, facebook::jsi::Value const&, facebook::jsi::Value const*, unsigned long)) >>> referenced by __tree:0 (C:/Users/willm/AppData/Local/Android/Sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/c++/v1/__tree:0) >>> CMakeFiles/VisionCamera.dir/src/main/cpp/frameprocessor/java-bindings/JFrameProcessor.cpp.o:(RNWorklet::WorkletInvoker::call(facebook::jsi::Runtime&, facebook::jsi::Value const&, facebook::jsi::Value const*, unsigned long)) ld: error: undefined symbol: RNWorklet::JsiWorkletContext::invokeOnWorkletThread(std::__ndk1::function<void (RNWorklet::JsiWorkletContext*, facebook::jsi::Runtime&)>&&) >>> referenced by WKTJsiWorklet.h:372 (C:/Users/willm/OneDrive/Documents/New folder/node_modules/react-native-worklets-core/android/build/headers/rnworklets/react-native-worklets-core/WKTJsiWorklet.h:372) >>> CMakeFiles/VisionCamera.dir/src/main/cpp/frameprocessor/java-bindings/JFrameProcessor.cpp.o:(RNWorklet::WorkletInvoker::~WorkletInvoker()) ld: error: undefined symbol: RNWorklet::JsiWorkletContext::invokeOnJsThread(std::__ndk1::function<void (facebook::jsi::Runtime&)>&&) >>> referenced by WKTJsiWorklet.h:369 (C:/Users/willm/OneDrive/Documents/New folder/node_modules/react-native-worklets-core/android/build/headers/rnworklets/react-native-worklets-core/WKTJsiWorklet.h:369) >>> CMakeFiles/VisionCamera.dir/src/main/cpp/frameprocessor/java-bindings/JFrameProcessor.cpp.o:(RNWorklet::WorkletInvoker::~WorkletInvoker()) ld: error: undefined symbol: RNWorklet::JsiWorkletContext::defaultInstance >>> referenced by memory:3887 (C:/Users/willm/AppData/Local/Android/Sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/c++/v1/memory:3887) >>> CMakeFiles/VisionCamera.dir/src/main/cpp/frameprocessor/java-bindings/JFrameProcessor.cpp.o:(RNWorklet::JsiWorkletContext::getDefaultInstance()) >>> referenced by memory:3887 (C:/Users/willm/AppData/Local/Android/Sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/c++/v1/memory:3887) >>> CMakeFiles/VisionCamera.dir/src/main/cpp/frameprocessor/java-bindings/JFrameProcessor.cpp.o:(RNWorklet::JsiWorkletContext::getDefaultInstance()) ld: error: undefined symbol: RNWorklet::JsiHostObject::JsiHostObject() >>> referenced by WKTJsiWorkletContext.h:31 (C:/Users/willm/OneDrive/Documents/New folder/node_modules/react-native-worklets-core/android/build/headers/rnworklets/react-native-worklets-core/WKTJsiWorkletContext.h:31) >>> CMakeFiles/VisionCamera.dir/src/main/cpp/frameprocessor/java-bindings/JFrameProcessor.cpp.o:(RNWorklet::JsiWorkletContext::getDefaultInstance()) >>> referenced by WKTJsiWorklet.h:77 (C:/Users/willm/OneDrive/Documents/New folder/node_modules/react-native-worklets-core/android/build/headers/rnworklets/react-native-worklets-core/WKTJsiWorklet.h:77) >>> CMakeFiles/VisionCamera.dir/src/main/cpp/frameprocessor/java-bindings/JVisionCameraProxy.cpp.o:(RNWorklet::JsiWorklet::JsiWorklet(facebook::jsi::Runtime&, facebook::jsi::Value const&)) ld: error: undefined symbol: vtable for RNWorklet::JsiWorkletContext >>> referenced by WKTJsiWorkletContext.h:31 (C:/Users/willm/OneDrive/Documents/New folder/node_modules/react-native-worklets-core/android/build/headers/rnworklets/react-native-worklets-core/WKTJsiWorkletContext.h:31) >>> CMakeFiles/VisionCamera.dir/src/main/cpp/frameprocessor/java-bindings/JFrameProcessor.cpp.o:(RNWorklet::JsiWorkletContext::getDefaultInstance()) >>> referenced by WKTJsiWorkletContext.h:31 (C:/Users/willm/OneDrive/Documents/New folder/node_modules/react-native-worklets-core/android/build/headers/rnworklets/react-native-worklets-core/WKTJsiWorkletContext.h:31) >>> CMakeFiles/VisionCamera.dir/src/main/cpp/frameprocessor/java-bindings/JFrameProcessor.cpp.o:(RNWorklet::JsiWorkletContext::getDefaultInstance()) >>> the vtable symbol may be undefined because the class is missing its key function (see https://lld.llvm.org/missingkeyfunction) ld: error: undefined symbol: RNWorklet::JsiWorkletContext::~JsiWorkletContext() >>> referenced by memory:2252 (C:/Users/willm/AppData/Local/Android/Sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/c++/v1/memory:2252) >>> CMakeFiles/VisionCamera.dir/src/main/cpp/frameprocessor/java-bindings/JFrameProcessor.cpp.o:(std::__ndk1::__shared_ptr_emplace<RNWorklet::JsiWorkletContext, std::__ndk1::allocatorRNWorklet::JsiWorkletContext >::~__shared_ptr_emplace()) >>> referenced by memory:2252 (C:/Users/willm/AppData/Local/Android/Sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/c++/v1/memory:2252) >>> CMakeFiles/VisionCamera.dir/src/main/cpp/frameprocessor/java-bindings/JFrameProcessor.cpp.o:(std::__ndk1::__shared_ptr_emplace<RNWorklet::JsiWorkletContext, std::__ndk1::allocatorRNWorklet::JsiWorkletContext >::~__shared_ptr_emplace()) ld: error: undefined symbol: RNWorklet::JsiWorkletContext::JsiWorkletContext(std::__ndk1::basic_string<char, std::__ndk1::char_traits, std::__ndk1::allocator > const&, facebook::jsi::Runtime*, std::__ndk1::function<void (std::__ndk1::function<void ()>&&)>, std::__ndk1::function<void (std::__ndk1::function<void ()>&&)>) >>> referenced by memory:2278 (C:/Users/willm/AppData/Local/Android/Sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/c++/v1/memory:2278) >>> CMakeFiles/VisionCamera.dir/src/main/cpp/frameprocessor/java-bindings/JVisionCameraProxy.cpp.o:(vision::JVisionCameraProxy::JVisionCameraProxy(facebook::jni::alias_ref<facebook::jni::detail::JTypeFor<facebook::jni::HybridClass<vision::JVisionCameraProxy, facebook::jni::detail::BaseHybridClass>::JavaPart, facebook::jni::JObject, void>::_javaobject*> const&, facebook::jsi::Runtime*, std::__ndk1::shared_ptrfacebook::react::CallInvoker const&, facebook::jni::basic_strong_ref<facebook::jni::detail::JTypeFor<facebook::jni::HybridClass<vision::JVisionCameraScheduler, facebook::jni::detail::BaseHybridClass>::JavaPart, facebook::jni::JObject, void>::_javaobject*, facebook::jni::GlobalReferenceAllocator> const&)) ld: error: undefined symbol: RNWorklet::JsiHostObject::~JsiHostObject() >>> referenced by WKTJsiWorklet.h:79 (C:/Users/willm/OneDrive/Documents/New folder/node_modules/react-native-worklets-core/android/build/headers/rnworklets/react-native-worklets-core/WKTJsiWorklet.h:79) >>> CMakeFiles/VisionCamera.dir/src/main/cpp/frameprocessor/java-bindings/JVisionCameraProxy.cpp.o:(RNWorklet::JsiWorklet::JsiWorklet(facebook::jsi::Runtime&, facebook::jsi::Value const&)) >>> referenced by WKTJsiWorklet.h:74 (C:/Users/willm/OneDrive/Documents/New folder/node_modules/react-native-worklets-core/android/build/headers/rnworklets/react-native-worklets-core/WKTJsiWorklet.h:74) >>> CMakeFiles/VisionCamera.dir/src/main/cpp/frameprocessor/java-bindings/JVisionCameraProxy.cpp.o:(RNWorklet::JsiWorklet::~JsiWorklet()) ld: error: undefined symbol: RNWorklet::JsiWrapper::wrap(facebook::jsi::Runtime&, facebook::jsi::Value const&, RNWorklet::JsiWrapper*) >>> referenced by WKTJsiWrapper.h:62 (C:/Users/willm/OneDrive/Documents/New folder/node_modules/react-native-worklets-core/android/build/headers/rnworklets/react-native-worklets-core/WKTJsiWrapper.h:62) >>> CMakeFiles/VisionCamera.dir/src/main/cpp/frameprocessor/java-bindings/JVisionCameraProxy.cpp.o:(RNWorklet::JsiWorklet::createWorklet(facebook::jsi::Runtime&, std::__ndk1::shared_ptrfacebook::jsi::Function)) ld: error: undefined symbol: RNWorklet::JsiHostObject::get(facebook::jsi::Runtime&, facebook::jsi::PropNameID const&) >>> referenced by JVisionCameraProxy.cpp >>> CMakeFiles/VisionCamera.dir/src/main/cpp/frameprocessor/java-bindings/JVisionCameraProxy.cpp.o:(vtable for RNWorklet::JsiWorklet) ld: error: undefined symbol: RNWorklet::JsiHostObject::set(facebook::jsi::Runtime&, facebook::jsi::PropNameID const&, facebook::jsi::Value const&) >>> referenced by JVisionCameraProxy.cpp >>> CMakeFiles/VisionCamera.dir/src/main/cpp/frameprocessor/java-bindings/JVisionCameraProxy.cpp.o:(vtable for RNWorklet::JsiWorklet) ld: error: undefined symbol: RNWorklet::JsiHostObject::getPropertyNames(facebook::jsi::Runtime&) >>> referenced by JVisionCameraProxy.cpp >>> CMakeFiles/VisionCamera.dir/src/main/cpp/frameprocessor/java-bindings/JVisionCameraProxy.cpp.o:(vtable for RNWorklet::JsiWorklet) ld: error: undefined symbol: typeinfo for RNWorklet::JsiHostObject >>> referenced by JVisionCameraProxy.cpp >>> CMakeFiles/VisionCamera.dir/src/main/cpp/frameprocessor/java-bindings/JVisionCameraProxy.cpp.o:(typeinfo for RNWorklet::JsiWorklet) clang++: 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: @echo off "C:UserswillmAppDataLocalAndroidSdkcmake3.22.1binninja.exe" ^ -C ^ "C:UserswillmOneDriveDocumentsNew foldernode_modulesreact-native-vision-cameraandroid.cxxDebug5a2g3g6parm64-v8a" ^ VisionCamera from C:UserswillmOneDriveDocumentsNew foldernode_modulesreact-native-vision-cameraandroid * 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 58s.`

These are the current versions of packages i believe could be the cause:
react-native-vision-camera: ^3.9.1
react-native-reanimated: ^3.7.1
react-native-worklets: ^0.0.1-alpha
react-native-worklets-core: ^0.3.0
react-native: 0.73.4

I am trying to build and install my react-native app on an android emulator. The code gets to the end of executing and then this error message gets displayed. I have tried deleting the gradle.build folder, restarting my computer, creating new virtual devices and changing my jdk version.

I have turned to you as I really need help resolving this.

If you need any more info please let me know

3

Answers


  1. Delete android/.gradle folder and retry.

    Issues already exist on react-native-vision-camera github for this, like this one :

    https://github.com/mrousavy/react-native-vision-camera/issues/1913

    Login or Signup to reply.
  2. Inspired by https://github.com/mrousavy/react-native-vision-camera/issues/1770 :

    1. Bundle Android Resources: Execute the command npx npm run bundle:android to bundle your Android resources.

    2. Clean the Android Project: Navigate to your Android project directory with cd android, then run ./gradlew clean to clean your Android project.

    3. Remove Dependencies and Android Build: Go back to your project root directory and remove all dependencies and the Android build with the command rm -rf -- node_modules package-lock.json android/build.

    4. Install All Dependencies: Run npx npm install --legacy-peer-deps to install all the necessary dependencies.

    5. Modify CMakeLists.txt: Open the file node_modules/react-native-vision-camera/android/CMakeLists.txt and add the following lines at the top of the file:

      set(ENABLE_FRAME_PROCESSORS ON)
      find_package(react-native-worklets-core REQUIRED CONFIG)
      
    6. Run the Project: Finally, launch your project from Android Studio.

    Login or Signup to reply.
    • check minSdkVersion =26 in /android/build.gradle
    • 2 bugs to correct by hand :

    https://github.com/mrousavy/react-native-vision-camera/issues/2290#issuecomment-2015227780

    and https://github.com/mrousavy/react-native-vision-camera/issues/1708#issuecomment-1708482345

    then suppress :
    /android/app/build

    and .cxx et build directories under node_modules/react-native-vision-camera/android/

    then yarn run android

    and that every time after a yarn !
    until react-native-worklets-core be corrected (here version 0.4.0) and react-native-vision-camera v3.9.1 also.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search