react-native-reanimated: [android build fails] 🐛 Execution failed for task ':react-native-reanimated:configureCMakeDebug[arm64-v8a]'.

Description

I’m getting following error (gradle error) when I try to run project on android emulator

Execution failed for task ':react-native-reanimated:configureCMakeDebug[arm64-v8a]'.
[CXX1405] exception while building Json A problem occurred starting process 'command '/Users/user_name/Library/Android/sdk/cmake/3.18.1/bin/cmake''

what I’ve tried so far:

  • cleaned gradle
  • cleaned yarn cache
  • cleaned metro bundler cache
  • installed required NDK (23.1.7779620)
  • installed CMake 3.18.1
  • cleaned watchman
  • added CMake in PATH (zsh shell)

react-native info

System:
    OS: macOS 13.2.1
    CPU: (8) arm64 Apple M2
    Memory: 74.30 MB / 8.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 18.17.0 - /var/folders/67/94h2xx9x1sg3h3_q1zgcltcc0000gn/T/yarn--1692780442554-0.3663945892745395/node
    Yarn: 1.22.19 - /var/folders/67/94h2xx9x1sg3h3_q1zgcltcc0000gn/T/yarn--1692780442554-0.3663945892745395/yarn
    npm: 9.6.7 - /usr/local/bin/npm
    Watchman: 2023.07.24.00 - /opt/homebrew/bin/watchman
  Managers:
    CocoaPods: 1.12.1 - /Users/user/.asdf/shims/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 22.4, iOS 16.4, macOS 13.3, tvOS 16.4, watchOS 9.4
    Android SDK: Not Found
  IDEs:
    Android Studio: 2022.3 AI-223.8836.35.2231.10406996
    Xcode: 14.3.1/14E300c - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.20 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.2.0 => 18.2.0 
    react-native: 0.71.12 => 0.71.12 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found
✨  Done in 14.43s.

Steps to reproduce

  1. run project yarn start --reset-cache
  2. run emulator
  3. run yarn android android build fails

Snack or a link to a repository

dummy.link

Reanimated version

3.4.2

React Native version

0.71.12

Platforms

Android

JavaScript runtime

Hermes

Workflow

React Native (without Expo)

Architecture

Paper (Old Architecture)

Build type

Debug mode

Device

Android emulator

Device model

No response

Acknowledgements

Yes

About this issue

  • Original URL
  • State: closed
  • Created 10 months ago
  • Reactions: 6
  • Comments: 15

Most upvoted comments

Resolved by following steps

  1. Remove build and .cxx folder in the android/app/ directory.
  2. Run the command in terminal : - cd android && ./gradlew clean
  3. Open gradle.properties files
  4. newArchEnabled=false
  5. Run the project : - cd … && npm start – --reset-cache - npm run android

Got same error

Execution failed for task ‘:react-native-reanimated:configureCMakeDebug[armeabi-v7a]’.

RN version: 0.73 Reanimated: 3.6.1

Resolved by following steps

  1. Android studio -> Tools -> SDK Manager -> SDK Tools -> install NDK and CMake
  2. Install brew install cmake in Mac
  3. Android studio -> invalidate cache
  4. open terminal -> cd android -> ./gradlew clean
  5. cd … npm start -- --reset-cache

Enable Bridgeless Mode

Bridgeless Mode

1. Enable Bridgeless flag in native

Android In your MainApplication.kt file, update the onCreate function by passing the bridglessEnabled = true flag to the load invocation.

// MyMainApplication.kt

import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load

override fun onCreate() {
  ...
  if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
    // Set bridgelessEnabled to true here to enable Bridgeless, it's false by default
-   load()
+   load(bridgelessEnabled = true)
  }
  ...
}

iOS

To enable Bridgeless for your React Native app, you need to override function bridgelessEnabled in app’s AppDelegate.mm:

// AppDelegate.mm

- (BOOL)bridgelessEnabled
{
    return YES;
}

2. Enable New Architectures

Open gradle.properties file newArchEnabled=true

FINALLY, Complete the configuration for Enable Bridgeless Mode.