I am trying to build an apk using command npx expo run:android but react-native-reanimated is being an issue and here is the error I am getting.
with the following tools I am using with Android studio
Android SDK 34
NDK version 27.0.11902837
Cmake version 3.22.1
Expo version 51.0.14
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':react-native-reanimated:buildCMakeDebug[armeabi-v7a]'.
com.android.ide.common.process.ProcessException: ninja: Entering directory /Users/justinmihigo/Movies/Andela/commanders-rn-medica/node_modules/react-native-reanimated/android/.cxx/Debug/4b404i17/armeabi-v7a'
[0/2] Re-checking globbed directories...
[1/22] Building CXX object CMakeFiles/reanimated.dir/Users/justinmihigo/Movies/Andela/commanders-rn-medica/node_modules/react-native-reanimated/Common/cpp/Tools/FeaturesConfig.cpp.o
[2/22] Building CXX object CMakeFiles/reanimated.dir/Users/justinmihigo/Movies/Andela/commanders-rn-medica/node_modules/react-native-reanimated/Common/cpp/Tools/AsyncQueue.cpp.o
[3/22] Building CXX object CMakeFiles/reanimated.dir/Users/justinmihigo/Movies/Andela/commanders-rn-medica/node_modules/react-native-reanimated/Common/cpp/ReanimatedRuntime/WorkletRuntimeDecorator.cpp.o
FAILED: CMakeFiles/reanimated.dir/Users/justinmihigo/Movies/Andela/commanders-rn-medica/node_modules/react-native-reanimated/Common/cpp/ReanimatedRuntime/WorkletRuntimeDecorator.cpp.o
/Users/justinmihigo/Library/Android/sdk/ndk/27.0.11902837/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ --target=armv7-none-linux-androideabi23 --sysroot=/Users/justinmihigo/Library/Android/sdk/ndk/27.0.11902837/toolchains/llvm/prebuilt/darwin-x86_64/sysroot -Dreanimated_EXPORTS -I/Users/justinmihigo/Movies/Andela/commanders-rn-medica/node_modules/react-native-reanimated/android/../Common/cpp/AnimatedSensor -I/Users/justinmihigo/Movies/Andela/commanders-rn-medica/node_modules/react-native-reanimated/android/../Common/cpp/Fabric -I/Users/justinmihigo/Movies/Andela/commanders-rn-medica/node_modules/react-native-reanimated/android/../Common/cpp/hidden_headers -I/Users/justinmihigo/Movies/Andela/commanders-rn-medica/node_modules/react-native-reanimated/android/../Common/cpp/LayoutAnimations -I/Users/justinmihigo/Movies/Andela/commanders-rn-medica/node_modules/react-native-reanimated/android/../Common/cpp/NativeModules -I/Users/justinmihigo/Movies/Andela/commanders-rn-medica/node_modules/react-native-reanimated/android/../Common/cpp/ReanimatedRuntime -I/Users/justinmihigo/Movies/Andela/commanders-rn-medica/node_modules/react-native-reanimated/android/../Common/cpp/Registries -I/Users/justinmihigo/Movies/Andela/commanders-rn-medica/node_modules/react-native-reanimated/android/../Common/cpp/SharedItems -I/Users/justinmihigo/Movies/Andela/commanders-rn-medica/node_modules/react-native-reanimated/android/../Common/cpp/Tools -I/Users/justinmihigo/Movies/Andela/commanders-rn-medica/node_modules/react-native-reanimated/android/src/main/cpp -I/Users/justinmihigo/Movies/Andela/commanders-rn-medica/node_modules/react-native/ReactAndroid/src/main/jni/react/turbomodule -I/Users/justinmihigo/Movies/Andela/commanders-rn-medica/node_modules/react-native/ReactCommon -I/Users/justinmihigo/Movies/Andela/commanders-rn-medica/node_modules/react-native/ReactCommon/callinvoker -I/Users/justinmihigo/Movies/Andela/commanders-rn-medica/node_modules/react-native/ReactCommon/react/renderer/graphics/platform/cxx -I/Users/justinmihigo/Movies/Andela/commanders-rn-medica/node_modules/react-native/ReactCommon/runtimeexecutor -I/Users/justinmihigo/Movies/Andela/commanders-rn-medica/node_modules/react-native/ReactCommon/yoga -isystem /Users/justinmihigo/.gradle/caches/8.8/transforms/2c8618dba5f00b01a1209815a9b362bf/transformed/jetified-react-android-0.74.2-debug/prefab/modules/folly_runtime/include -isystem /Users/justinmihigo/.gradle/caches/8.8/transforms/2c8618dba5f00b01a1209815a9b362bf/transformed/jetified-react-android-0.74.2-debug/prefab/modules/glog/include -isystem /Users/justinmihigo/.gradle/caches/8.8/transforms/2c8618dba5f00b01a1209815a9b362bf/transformed/jetified-react-android-0.74.2-debug/prefab/modules/jsi/include -isystem /Users/justinmihigo/.gradle/caches/8.8/transforms/2c8618dba5f00b01a1209815a9b362bf/transformed/jetified-react-android-0.74.2-debug/prefab/modules/reactnativejni/include -isystem /Users/justinmihigo/.gradle/caches/8.8/transforms/856443df8f0b9507a40bed972a7fd1db/transformed/jetified-fbjni-0.6.0/prefab/modules/fbjni/include -isystem /Users/justinmihigo/.gradle/caches/8.8/transforms/6ba80613f678771b36f9bb851dbda272/transformed/jetified-hermes-android-0.74.2-debug/prefab/modules/libhermes/include -isystem /Users/justinmihigo/.gradle/caches/8.8/transforms/2c8618dba5f00b01a1209815a9b362bf/transformed/jetified-react-android-0.74.2-debug/prefab/modules/hermes_executor/include -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -march=armv7-a -mthumb -Wformat -Werror=format-security -DREACT_NATIVE_MINOR_VERSION=74 -DREANIMATED_VERSION=3.10.1 -DHERMES_ENABLE_DEBUGGER=1 -fexceptions -fno-omit-frame-pointer -frtti -fstack-protector-all -std=c++20 -Wall -Werror -DJS_RUNTIME_HERMES=1 -fno-limit-debug-info -fPIC -DFOLLY_NO_CONFIG=1 -DFOLLY_HAVE_CLOCK_GETTIME=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_CFG_NO_COROUTINES=1 -DFOLLY_MOBILE=1 -DFOLLY_HAVE_RECVMMSG=1 -DFOLLY_HAVE_PTHREAD=1 -DFOLLY_HAVE_XSI_STRERROR_R=1 -std=gnu++20 -MD -MT CMakeFiles/reanimated.dir/Users/justinmihigo/Movies/Andela/commanders-rn-medica/node_modules/react-native-reanimated/Common/cpp/ReanimatedRuntime/WorkletRuntimeDecorator.cpp.o -MF CMakeFiles/reanimated.dir/Users/justinmihigo/Movies/Andela/commanders-rn-medica/node_modules/react-native-reanimated/Common/cpp/ReanimatedRuntime/WorkletRuntimeDecorator.cpp.o.d -o CMakeFiles/reanimated.dir/Users/justinmihigo/Movies/Andela/commanders-rn-medica/node_modules/react-native-reanimated/Common/cpp/ReanimatedRuntime/WorkletRuntimeDecorator.cpp.o -c /Users/justinmihigo/Movies/Andela/commanders-rn-medica/node_modules/react-native-reanimated/Common/cpp/ReanimatedRuntime/WorkletRuntimeDecorator.cpp
/Users/justinmihigo/Movies/Andela/commanders-rn-medica/node_modules/react-native-reanimated/Common/cpp/ReanimatedRuntime/WorkletRuntimeDecorator.cpp:115:29: error: variable length arrays in C++ are a Clang extension [-Werror,-Wvla-cxx-extension]
115 | jsi::Value args[argsSize]; // NOLINT(runtime/arrays)
| ^~~~
/Users/justinmihigo/Movies/Andela/commanders-rn-medica/node_modules/react-native-reanimated/Common/cpp/ReanimatedRuntime/WorkletRuntimeDecorator.cpp:115:29: note: read of non-const variable 'argsSize' is not allowed in a constant expression
/Users/justinmihigo/Movies/Andela/commanders-rn-medica/node_modules/react-native-reanimated/Common/cpp/ReanimatedRuntime/WorkletRuntimeDecorator.cpp:112:18: note: declared here
112 | auto argsSize = argsArray.size(rt);
| ^
1 error generated.
[4/22] Building CXX object CMakeFiles/reanimated.dir/Users/justinmihigo/Movies/Andela/commanders-rn-medica/node_modules/react-native-reanimated/Common/cpp/Registries/EventHandlerRegistry.cpp.o
[5/22] Building CXX object CMakeFiles/reanimated.dir/Users/justinmihigo/Movies/Andela/commanders-rn-medica/node_modules/react-native-reanimated/Common/cpp/Tools/JSISerializer.cpp.o
[6/22] Building CXX object CMakeFiles/reanimated.dir/Users/justinmihigo/Movies/Andela/commanders-rn-medica/node_modules/react-native-reanimated/Common/cpp/SharedItems/Shareables.cpp.o
[7/22] Building CXX object CMakeFiles/reanimated.dir/Users/justinmihigo/Movies/Andela/commanders-rn-medica/node_modules/react-native-reanimated/Common/cpp/NativeModules/NativeReanimatedModule.cpp.o
FAILED: CMakeFiles/reanimated.dir/Users/justinmihigo/Movies/Andela/commanders-rn-medica/node_modules/react-native-reanimated/Common/cpp/NativeModules/NativeReanimatedModule.cpp.o
/Users/justinmihigo/Library/Android/sdk/ndk/27.0.11902837/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ --target=armv7-none-linux-androideabi23 --sysroot=/Users/justinmihigo/Library/Android/sdk/ndk/27.0.11902837/toolchains/llvm/prebuilt/darwin-x86_64/sysroot -Dreanimated_EXPORTS -I/Users/justinmihigo/Movies/Andela/commanders-rn-medica/node_modules/react-native-reanimated/android/../Common/cpp/AnimatedSensor -I/Users/justinmihigo/Movies/Andela/commanders-rn-medica/node_modules/react-native-reanimated/android/../Common/cpp/Fabric -I/Users/justinmihigo/Movies/Andela/commanders-rn-medica/node_modules/react-native-reanimated/android/../Common/cpp/hidden_headers -I/Users/justinmihigo/Movies/Andela/commanders-rn-medica/node_modules/react-native-reanimated/android/../Common/cpp/LayoutAnimations -I/Users/justinmihigo/Movies/Andela/commanders-rn-medica/node_modules/react-native-reanimated/android/../Common/cpp/NativeModules -I/Users/justinmihigo/Movies/Andela/commanders-rn-medica/node_modules/react-native-reanimated/android/../Common/cpp/ReanimatedRuntime -I/Users/justinmihigo/Movies/Andela/commanders-rn-medica/node_modules/react-native-reanimated/android/../Common/cpp/Registries -I/Users/justinmihigo/Movies/Andela/commanders-rn-medica/node_modules/react-native-reanimated/android/../Common/cpp/SharedItems -I/Users/justinmihigo/Movies/Andela/commanders-rn-medica/node_modules/react-native-reanimated/android/../Common/cpp/Tools -I/Users/justinmihigo/Movies/Andela/commanders-rn-medica/node_modules/react-native-reanimated/android/src/main/cpp -I/Users/justinmihigo/Movies/Andela/commanders-rn-medica/node_modules/react-native/ReactAndroid/src/main/jni/react/turbomodule -I/Users/justinmihigo/Movies/Andela/commanders-rn-medica/node_modules/react-native/ReactCommon -I/Users/justinmihigo/Movies/Andela/commanders-rn-medica/node_modules/react-native/ReactCommon/callinvoker -I/Users/justinmihigo/Movies/Andela/commanders-rn-medica/node_modules/react-native/ReactCommon/react/renderer/graphics/platform/cxx -I/Users/justinmihigo/Movies/Andela/commanders-rn-medica/node_modules/react-native/ReactCommon/runtimeexecutor -I/Users/justinmihigo/Movies/Andela/commanders-rn-medica/node_modules/react-native/ReactCommon/yoga -isystem /Users/justinmihigo/.gradle/caches/8.8/transforms/2c8618dba5f00b01a1209815a9b362bf/transformed/jetified-react-android-0.74.2-debug/prefab/modules/folly_runtime/include -isystem /Users/justinmihigo/.gradle/caches/8.8/transforms/2c8618dba5f00b01a1209815a9b362bf/transformed/jetified-react-android-0.74.2-debug/prefab/modules/glog/include -isystem /Users/justinmihigo/.gradle/caches/8.8/transforms/2c8618dba5f00b01a1209815a9b362bf/transformed/jetified-react-android-0.74.2-debug/prefab/modules/jsi/include -isystem /Users/justinmihigo/.gradle/caches/8.8/transforms/2c8618dba5f00b01a1209815a9b362bf/transformed/jetified-react-android-0.74.2-debug/prefab/modules/reactnativejni/include -isystem /Users/justinmihigo/.gradle/caches/8.8/transforms/856443df8f0b9507a40bed972a7fd1db/transformed/jetified-fbjni-0.6.0/prefab/modules/fbjni/include -isystem /Users/justinmihigo/.gradle/caches/8.8/transforms/6ba80613f678771b36f9bb851dbda272/transformed/jetified-hermes-android-0.74.2-debug/prefab/modules/libhermes/include -isystem /Users/justinmihigo/.gradle/caches/8.8/transforms/2c8618dba5f00b01a1209815a9b362bf/transformed/jetified-react-android-0.74.2-debug/prefab/modules/hermes_executor/include -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -march=armv7-a -mthumb -Wformat -Werror=format-security -DREACT_NATIVE_MINOR_VERSION=74 -DREANIMATED_VERSION=3.10.1 -DHERMES_ENABLE_DEBUGGER=1 -fexceptions -fno-omit-frame-pointer -frtti -fstack-protector-all -std=c++20 -Wall -Werror -DJS_RUNTIME_HERMES=1 -fno-limit-debug-info -fPIC -DFOLLY_NO_CONFIG=1 -DFOLLY_HAVE_CLOCK_GETTIME=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_CFG_NO_COROUTINES=1 -DFOLLY_MOBILE=1 -DFOLLY_HAVE_RECVMMSG=1 -DFOLLY_HAVE_PTHREAD=1 -DFOLLY_HAVE_XSI_STRERROR_R=1 -std=gnu++20 -MD -MT CMakeFiles/reanimated.dir/Users/justinmihigo/Movies/Andela/commanders-rn-medica/node_modules/react-native-reanimated/Common/cpp/NativeModules/NativeReanimatedModule.cpp.o -MF CMakeFiles/reanimated.dir/Users/justinmihigo/Movies/Andela/commanders-rn-medica/node_modules/react-native-reanimated/Common/cpp/NativeModules/NativeReanimatedModule.cpp.o.d -o CMakeFiles/reanimated.dir/Users/justinmihigo/Movies/Andela/commanders-rn-medica/node_modules/react-native-reanimated/Common/cpp/NativeModules/NativeReanimatedModule.cpp.o -c /Users/justinmihigo/Movies/Andela/commanders-rn-medica/node_modules/react-native-reanimated/Common/cpp/NativeModules/NativeReanimatedModule.cpp
/Users/justinmihigo/Movies/Andela/commanders-rn-medica/nodemodules/react-native-reanimated/Common/cpp/NativeModules/NativeReanimatedModule.cpp:176:35: error: implicit capture of 'this' with a capture default of '=' is deprecated [-Werror,-Wdeprecated-this-capture]
176 | const auto scope = jsi::Scope(uiWorkletRuntime->getJSIRuntime());
| ^
/Users/justinmihigo/Movies/Andela/commanders-rn-medica/nodemodules/react-native-reanimated/Common/cpp/NativeModules/NativeReanimatedModule.cpp:169:31: note: add an explicit capture of 'this' to capture '*this' by reference
169 | uiScheduler->scheduleOnUI([=] {
| ^
| , this
/Users/justinmihigo/Movies/Andela/commanders-rn-medica/nodemodules/react-native-reanimated/Common/cpp/NativeModules/NativeReanimatedModule.cpp:238:5: error: implicit capture of 'this' with a capture default of '=' is deprecated [-Werror,-Wdeprecated-this-capture]
238 | eventHandlerRegistry->registerEventHandler(std::move(handler));
| ^
/Users/justinmihigo/Movies/Andela/commanders-rn-medica/nodemodules/react-native-reanimated/Common/cpp/NativeModules/NativeReanimatedModule.cpp:235:31: note: add an explicit capture of 'this' to capture '*this' by reference
235 | uiScheduler->scheduleOnUI([=] {
| ^
| , this
/Users/justinmihigo/Movies/Andela/commanders-rn-medica/nodemodules/react-native-reanimated/Common/cpp/NativeModules/NativeReanimatedModule.cpp:249:13: error: implicit capture of 'this' with a capture default of '=' is deprecated [-Werror,-Wdeprecated-this-capture]
249 | [=] { eventHandlerRegistry->unregisterEventHandler(id); });
| ^
/Users/justinmihigo/Movies/Andela/commanders-rn-medica/nodemodules/react-native-reanimated/Common/cpp/NativeModules/NativeReanimatedModule.cpp:249:8: note: add an explicit capture of 'this' to capture '*this' by reference
249 | [=] { eventHandlerRegistry->unregisterEventHandler(id); });
| ^
| , this
/Users/justinmihigo/Movies/Andela/commanders-rn-medica/nodemodules/react-native-reanimated/Common/cpp/NativeModules/NativeReanimatedModule.cpp:346:31: error: implicit capture of 'this' with a capture default of '=' is deprecated [-Werror,-Wdeprecated-this-capture]
346 | jsi::Runtime &uiRuntime = uiWorkletRuntime->getJSIRuntime();
| ^
/Users/justinmihigo/Movies/Andela/commanders-rn-medica/nodemodules/react-native-reanimated/Common/cpp/NativeModules/NativeReanimatedModule.cpp:345:31: note: add an explicit capture of 'this' to capture '*this' by reference
345 | uiScheduler->scheduleOnUI([=]() {
| ^
| , this
/Users/justinmihigo/Movies/Andela/commanders-rn-medica/nodemodules/react-native-reanimated/Common/cpp/NativeModules/NativeReanimatedModule.cpp:833:9: error: implicit capture of 'this' with a capture default of '=' is deprecated [-Werror,-Wdeprecated-this-capture]
833 | uiWorkletRuntime->runGuarded(
| ^
/Users/justinmihigo/Movies/Andela/commanders-rn-medica/node_modules/react-native-reanimated/Common/cpp/NativeModules/NativeReanimatedModule.cpp:832:8: note: add an explicit capture of 'this' to capture '*this' by reference
832 | [=](int keyboardState, int height) {
| ^
| , this
5 errors generated.
[8/22] Building CXX object CMakeFiles/reanimated.dir/Users/justinmihigo/Movies/Andela/commanders-rn-medica/node_modules/react-native-reanimated/Common/cpp/Tools/JSLogger.cpp.o
ninja: build stopped: subcommand failed.
C++ build system [build] failed while executing:
/Users/justinmihigo/Library/Android/sdk/cmake/3.22.1/bin/ninja \
-C \
/Users/justinmihigo/Movies/Andela/commanders-rn-medica/node_modules/react-native-reanimated/android/.cxx/Debug/4b404i17/armeabi-v7a \
reanimated
from /Users/justinmihigo/Movies/Andela/commanders-rn-medica/node_modules/react-native-reanimated/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.
Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
Description
I am trying to build an apk using command
npx expo run:android
but react-native-reanimated is being an issue and here is the error I am getting. with the following tools I am using with Android studioAndroid SDK 34
NDK version 27.0.11902837
Cmake version 3.22.1
Expo version 51.0.14 FAILURE: Build failed with an exception.
What went wrong: Execution failed for task ':react-native-reanimated:buildCMakeDebug[armeabi-v7a]'.
C++ build system [build] failed while executing: /Users/justinmihigo/Library/Android/sdk/cmake/3.22.1/bin/ninja \ -C \ /Users/justinmihigo/Movies/Andela/commanders-rn-medica/node_modules/react-native-reanimated/android/.cxx/Debug/4b404i17/armeabi-v7a \ reanimated from /Users/justinmihigo/Movies/Andela/commanders-rn-medica/node_modules/react-native-reanimated/android
Try:
Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
For more on this, please refer to https://docs.gradle.org/8.8/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.
BUILD FAILED in 1m 20s 799 actionable tasks: 47 executed, 752 up-to-date Error: /Users/justinmihigo/Movies/Andela/commanders-rn-medica/android/gradlew app:assembleDebug -x lint -x test --configure-on-demand --build-cache -PreactNativeDevServerPort=8081 -PreactNativeArchitectures=x86,armeabi-v7a exited with non-zero code: 1 Error: /Users/justinmihigo/Movies/Andela/commanders-rn-medica/android/gradlew app:assembleDebug -x lint -x test --configure-on-demand --build-cache -PreactNativeDevServerPort=8081 -PreactNativeArchitectures=x86,armeabi-v7a exited with non-zero code: 1 at ChildProcess.completionListener (/Users/justinmihigo/Movies/Andela/commanders-rn-medica/node_modules/@expo/cli/node_modules/@expo/spawn-async/build/spawnAsync.js:42:23) at Object.onceWrapper (node:events:633:26) at ChildProcess.emit (node:events:518:28) at maybeClose (node:internal/child_process:1105:16) at ChildProcess._handle.onexit (node:internal/child_process:305:5) ... at spawnAsync (/Users/justinmihigo/Movies/Andela/commanders-rn-medica/node_modules/@expo/cli/node_modules/@expo/spawn-async/build/spawnAsync.js:7:23) at spawnGradleAsync (/Users/justinmihigo/Movies/Andela/commanders-rn-medica/node_modules/@expo/cli/build/src/start/platforms/android/gradle.js:96:48) at assembleAsync (/Users/justinmihigo/Movies/Andela/commanders-rn-medica/node_modules/@expo/cli/build/src/start/platforms/android/gradle.js:74:18) at runAndroidAsync (/Users/justinmihigo/Movies/Andela/commanders-rn-medica/node_modules/@expo/cli/build/src/run/android/runAndroidAsync.js:45:37)
Steps to reproduce
npm install
npx expo run:android or npm run android
Snack or a link to a repository
https://github.com/justinmihigo/facebook-login-rn/tree/master
Reanimated version
3.10.1
React Native version
50.0.14
Platforms
Android
JavaScript runtime
Hermes
Workflow
Expo Go
Architecture
Fabric (New Architecture)
Build type
Release app & dev bundle
Device
Android emulator
Device model
Pixel_4 Android 11
Acknowledgements
Yes