Closed tomerh2001 closed 9 months ago
Fixed by clearing cache. This can be closed.
@tomerh2001 how did you clean the cache mate? 🤔 I already reinstalled npm packages, executed npm cache clean --force
and deleted the build android folders and nothing works :/
@jdnichollsc Were you able to clean your cache?
Build-> Clean Project,This can be closed.
I want to report that I am still replicating the error in my production builds. Even after clearing cache only, I have experienced this issue on a regular basis.
My environment:
OS: Mac M1
"react-native": "0.73.6",
"react-native-vision-camera": "^4.0.3",
"react-native-worklets-core": "^1.3.3",
I've also read through the other reports of this (e.g. #2511 #2418 #2290 #2286)
This has worked for me:
However I think this is only good for a workaround.
I have spent a day investigating the build process. By comparing the entire directories of successful builds and failed builds, I have found the following:
react-native-vision-camera/android/.cxx/RelWithDebInfo/2m415h14/prefab/arm64-v8a/prefab/lib/aarch64-linux-android/cmake/react-native-worklets-core/react-native-worklets-coreConfig.cmake
file:Not working:
if(NOT TARGET react-native-worklets-core::rnworklets)
add_library(react-native-worklets-core::rnworklets INTERFACE IMPORTED)
set_target_properties(react-native-worklets-core::rnworklets PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "{PROJECT_DIR}/node_modules/react-native-worklets-core/android/build/headers/rnworklets"
INTERFACE_LINK_LIBRARIES ""
)
endif()
Working:
if(NOT TARGET react-native-worklets-core::rnworklets)
add_library(react-native-worklets-core::rnworklets SHARED IMPORTED)
set_target_properties(react-native-worklets-core::rnworklets PROPERTIES
IMPORTED_LOCATION "{PROJECT_DIR}/node_modules/react-native-worklets-core/android/build/intermediates/cxx/RelWithDebInfo/322qv2c4/obj/arm64-v8a/librnworklets.so"
INTERFACE_INCLUDE_DIRECTORIES "{PROJECT_DIR}/node_modules/react-native-worklets-core/android/build/headers/rnworklets"
INTERFACE_LINK_LIBRARIES ""
)
endif()
/react-native-vision-camera/android/.cxx/RelWithDebInfo/2m415h14/arm64-v8a/android_gradle_build.json
:
Not working:
...
"libraries": {
"VisionCamera::@6890427a1f51a3e7e1df": {
"toolchain": "toolchain",
"abi": "arm64-v8a",
"artifactName": "VisionCamera",
"output": "{PROJECT_DIR}/node_modules/react-native-vision-camera/android/build/intermediates/cxx/RelWithDebInfo/2m415h14/obj/arm64-v8a/libVisionCamera.so",
"runtimeFiles": [
"~/.gradle/caches/transforms-3/b89c75dfebd78a0b3752403ce5c7230e/transformed/jetified-react-android-0.73.6-release/prefab/modules/jsi/libs/android.arm64-v8a/libjsi.so",
"~/.gradle/caches/transforms-3/b89c75dfebd78a0b3752403ce5c7230e/transformed/jetified-react-android-0.73.6-release/prefab/modules/reactnativejni/libs/android.arm64-v8a/libreactnativejni.so",
"~/.gradle/caches/transforms-3/228d163c1ef1c5981a4c5ae46d013f7c/transformed/jetified-fbjni-0.5.1/prefab/modules/fbjni/libs/android.arm64-v8a/libfbjni.so"
]
}
},
...
Working:
...
"libraries": {
"VisionCamera::@6890427a1f51a3e7e1df": {
"toolchain": "toolchain",
"abi": "arm64-v8a",
"artifactName": "VisionCamera",
"output": "{PROJECT_DIR}/node_modules/react-native-vision-camera/android/build/intermediates/cxx/RelWithDebInfo/2m415h14/obj/arm64-v8a/libVisionCamera.so",
"runtimeFiles": [
"~/.gradle/caches/transforms-3/b89c75dfebd78a0b3752403ce5c7230e/transformed/jetified-react-android-0.73.6-release/prefab/modules/jsi/libs/android.arm64-v8a/libjsi.so",
"~/.gradle/caches/transforms-3/b89c75dfebd78a0b3752403ce5c7230e/transformed/jetified-react-android-0.73.6-release/prefab/modules/reactnativejni/libs/android.arm64-v8a/libreactnativejni.so",
"~/.gradle/caches/transforms-3/228d163c1ef1c5981a4c5ae46d013f7c/transformed/jetified-fbjni-0.5.1/prefab/modules/fbjni/libs/android.arm64-v8a/libfbjni.so",
"{PROJECT_DIR}/node_modules/react-native-worklets-core/android/build/intermediates/cxx/RelWithDebInfo/322qv2c4/obj/arm64-v8a/librnworklets.so"
]
}
},
...
(have replaced home and project directory with ~ and {PROJECT_DIR} in above snippets for privacy)
The above file differences may only be the side effect of how this is happening. Unfortunately I'm not so familiar with the build process, but perhaps someone who is more knowledgeable about this could shed a light into why this might be happening?
Other things I have attempted but not worked:
Add this script to your package.json under scripts:
"clean": "rm -rf $TMPDIR/react-* && watchman watch-del-all && npm cache clean --force && rm -rf android/.gradle android/.idea android/app/build android/build && rm -rf node_modules"
Usually solves the problem:
BUILD FAILED in 17s
error Failed to install the app. Command failed with exit code 1: ./gradlew app:installDebug -PreactNativeDevServerPort=8081 FAILURE: Build failed with an exception. * What went wrong:
Execution failed for task ':react-native-vision-camera:buildCMakeDebug[arm64-v8a]
This issue still happens, clearing the cache and removing node_modules when xcode is running is not really a solution.
How were you trying to build the app?
yarn start
Full build logs