react-native-reanimated: Task :react-native-reanimated:configureCMakeDebug[arm64-v8a] FAILED for Android In empty project
Description
We recently upgraded to latest React-Native (0.72.2) and upgraded Reanimated to 3.3.0. After this upgrade, we get the following error when running assembleDebug for Android:
Task :react-native-reanimated:configureCMakeDebug[arm64-v8a] FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-reanimated:configureCMakeDebug[arm64-v8a]'.
> Picked up _JAVA_OPTIONS: -Xmx2048M
After failing to find a solution to the issue I created a brand new react native project with react-native-reanimated and tried building it for Android:
npx react-native init ReactNativeTest
cd ReactNativeTest
npm i react-native-reanimated
cd android
gradlew clean
gradlew assembleDebug
Also added to babel config.:
plugins: [
[
'react-native-reanimated/plugin',
{
relativeSourceLocation: true,
},
],
],
The same error occurs in the brand new project.
npx react-native run-android fails with the same error as assembleDebug.
Reanimated builds and runs as expected on iOS devices using Xcode.
Steps to reproduce
- Init a new react native project
- install reanimated using npm
- clean and build for android
Snack or a link to a repository
https://github.com/DigohD/Reanimated-build-error-cmake-config-issue-repo
Reanimated version
3.3.0
React Native version
0.72.2
Platforms
Android
JavaScript runtime
Hermes
Workflow
React Native (without Expo)
Architecture
Paper (Old Architecture)
Build type
Debug mode
Device
None
Device model
No response
Acknowledgements
Yes
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 8
- Comments: 22 (3 by maintainers)
Encountered a similar issue here: https://github.com/react-native-community/react-native-circleci-orb/issues/171 With some (ndk? sdk?) versions, the
Picked up _JAVA_OPTIONS
output causes a failure. Removing_JAVA_OPTIONS
from the environment will fix it.can you try with ndk
24.0.8215888
?This worked for me (Windows 10 | react-native 0.72.5 | react-native-reanimated 3.5.4)
It’s funny and absurd, but the issue is due to the project path being too long. I recommend copying or moving your project to c:\ or desktop. Delete the node_modules folder, run npm i, cd android & ./gradlew clean, and then build.
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
iOS
To enable Bridgeless for your React Native app, you need to override function bridgelessEnabled in app’s AppDelegate.mm:
// AppDelegate.mm
2. Enable New Architectures
Open gradle.properties file
newArchEnabled=true
FINALLY, Complete the configuration for Enable Bridgeless Mode.
Remove
_JAVA_OPTIONS
in cimg/android on circleci and it works now Thank youI reset my PC and reinstalled everything and now it works. I tried re-adding the _JAVA_OPTIONS variable just to check if that could be the issue I had before, and it indeed causes the error to come back.
I did not try ndk 24.0.8215888, but tried ndk 25 yesterday which did not solve the issue.
Thank you all for helping me out.
Resolved by following steps
newArchEnabled=false