react-native-reanimated: Cannot build when using Android flavours
Description
When using Android flavours running into blocking build issues e.g.
- No variants found for XXX
- Task :react-native-reanimated:configureCMakeDebug[arm64-v8a] FAILED … java.lang.StackOverflowError (no error message)
I can reproduce 1 in the Example project - https://github.com/konstantindt/react-native-reanimated/commit/a08bb9db42e0b63795bb3bbafd30d4bac30534be - which I when pass to Android Studio “Import Project (Gradle, Eclipse ADT, etc.)” the importing fails:
No variants found for ‘:react-native-box2d’. Check build files to ensure at least one variant exists. at: com.android.tools.idea.gradle.project.sync.AndroidModule.prepare(GradleModules.kt:266) …
About Android Studio:
Android Studio Flamingo | 2022.2.1
Build #AI-222.4459.24.2221.9862592, built on March 31, 2023
Runtime version: 17.0.6+0-17.0.6b802.4-9586694 aarch64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 13.4
GC: G1 Young Generation, G1 Old Generation
Memory: 2048M
Cores: 10
Metal Rendering is ON
Registry:
external.system.auto.import.disabled=true
ide.text.editor.with.preview.show.floating.toolbar=false
gradle.version.catalogs.dynamic.support=true
Steps to reproduce
- cd path/to/react-native-projects
- gh repo clone konstantindt/react-native-reanimated
- cd react-native-reanimated
- yarn install
- cd Example
- yarn install
- Open Android Studio -> Projects -> “Import Project (Gradle, Eclipse ADT, etc.)”
- Open path/to/react-native-projects/react-native-reanimated/Example/android
Snack or a link to a repository
https://github.com/konstantindt/react-native-reanimated
Reanimated version
3.2.0
React Native version
0.72.0-rc.3
Platforms
Android
JavaScript runtime
Hermes
Workflow
React Native (without Expo)
Architecture
Paper (Old Architecture)
Build type
None
Device
None
Device model
No response
Acknowledgements
Yes
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 11
- Comments: 41 (4 by maintainers)
I have the same issue in version 2.17.0 with react-native 0.72
A fix for the issue is at most required. Please share the update for this as soon as possible. Failing only on CircleCI.
I may have found a fix to build on Android. After upgrading the Gradle plugin version to 7.4.2 (from 7.3.1 in my case), I was able to assemble a build with Reanimated 3.3.0, without the cmake error. I’d be interested to see if this fixes it for other people.
I’m also experiencing the build error
on 3.2.0. (The build works on 2.17.0, but fails on all 3.x versions.)
Relevant debug logs:
Details
Starting process 'command '/Users/admin/code/app/node_modules/react-native-reanimated/android/build/intermediates/cxx/RelWithDebInfo/2u516l44/logs/arm64-v8a/prefab_command''. Working directory: /Users/admin/code/app/node_modules/react-native-reanimated/android Command: /Users/admin/code/app/node_modules/react-native-reanimated/android/build/intermediates/cxx/RelWithDebInfo/2u516l44/logs/arm64-v8a/prefab_command Successfully started process 'command '/Users/admin/code/app/node_modules/react-native-reanimated/android/build/intermediates/cxx/RelWithDebInfo/2u516l44/logs/arm64-v8a/prefab_command'' C/C++: /Users/admin/code/app/node_modules/react-native-reanimated/android/CMakeLists.txt release|arm64-v8a : removing stale contents from '/Users/admin/code/app/node_modules/react-native-reanimated/android/.cxx/RelWithDebInfo/2u516l44/arm64-v8a' C/C++: /Users/admin/code/app/node_modules/react-native-reanimated/android/CMakeLists.txt release|arm64-v8a : created folder '/Users/admin/code/app/node_modules/react-native-reanimated/android/.cxx/RelWithDebInfo/2u516l44/arm64-v8a' C/C++: /Users/admin/code/app/node_modules/react-native-reanimated/android/CMakeLists.txt release|arm64-v8a : executing cmake /Users/admin/Library/Android/sdk/cmake/3.18.1/bin/cmake \ -H/Users/admin/code/app/node_modules/react-native-reanimated/android \ -DCMAKE_SYSTEM_NAME=Android \ -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ -DCMAKE_SYSTEM_VERSION=26 \ -DANDROID_PLATFORM=android-26 \ -DANDROID_ABI=arm64-v8a \ -DCMAKE_ANDROID_ARCH_ABI=arm64-v8a \ -DANDROID_NDK=/Users/admin/Library/Android/sdk/ndk/23.1.7779620 \ -DCMAKE_ANDROID_NDK=/Users/admin/Library/Android/sdk/ndk/23.1.7779620 \ -DCMAKE_TOOLCHAIN_FILE=/Users/admin/Library/Android/sdk/ndk/23.1.7779620/build/cmake/android.toolchain.cmake \ -DCMAKE_MAKE_PROGRAM=/Users/admin/Library/Android/sdk/cmake/3.18.1/bin/ninja \ -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/Users/admin/code/app/node_modules/react-native-reanimated/android/build/intermediates/cxx/RelWithDebInfo/2u516l44/obj/arm64-v8a \ -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=/Users/admin/code/app/node_modules/react-native-reanimated/android/build/intermediates/cxx/RelWithDebInfo/2u516l44/obj/arm64-v8a \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DCMAKE_FIND_ROOT_PATH=/Users/admin/code/app/node_modules/react-native-reanimated/android/.cxx/RelWithDebInfo/2u516l44/prefab/arm64-v8a/prefab \ -B/Users/admin/code/app/node_modules/react-native-reanimated/android/.cxx/RelWithDebInfo/2u516l44/arm64-v8a \ -GNinja \ -DANDROID_STL=c++_shared \ -DREACT_NATIVE_MINOR_VERSION=71 \ -DANDROID_TOOLCHAIN=clang \ -DREACT_NATIVE_DIR=/Users/admin/code/app/node_modules/react-native \ -DJS_RUNTIME=hermes \ -DJS_RUNTIME_DIR=/Users/admin/code/app/node_modules/react-native/sdks/hermes \ -DCLIENT_SIDE_BUILD=true \ -DIS_NEW_ARCHITECTURE_ENABLED=false \ -DIS_REANIMATED_EXAMPLE_APP=false \ -DPLAYGROUND_APP_NAME=app \ -DREANIMATED_PACKAGE_BUILD=null \ -DREANIMATED_VERSION=3.2.0 \ -DHERMES_ENABLE_DEBUGGER=0- What went wrong:
Execution failed for task ‘:react-native-reanimated:configureCMakeRelWithDebInfo[arm64-v8a]’.
C/C++: /Users/admin/code/app/node_modules/react-native-reanimated/android/CMakeLists.txt release|arm64-v8a : /Users/admin/Library/Android/sdk/cmake/3.18.1/bin/cmake
-H/Users/admin/code/app/node_modules/react-native-reanimated/android
-DCMAKE_SYSTEM_NAME=Android
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
-DCMAKE_SYSTEM_VERSION=26
-DANDROID_PLATFORM=android-26
-DANDROID_ABI=arm64-v8a
-DCMAKE_ANDROID_ARCH_ABI=arm64-v8a
-DANDROID_NDK=/Users/admin/Library/Android/sdk/ndk/23.1.7779620
-DCMAKE_ANDROID_NDK=/Users/admin/Library/Android/sdk/ndk/23.1.7779620
-DCMAKE_TOOLCHAIN_FILE=/Users/admin/Library/Android/sdk/ndk/23.1.7779620/build/cmake/android.toolchain.cmake
-DCMAKE_MAKE_PROGRAM=/Users/admin/Library/Android/sdk/cmake/3.18.1/bin/ninja
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/Users/admin/code/app/node_modules/react-native-reanimated/android/build/intermediates/cxx/RelWithDebInfo/2u516l44/obj/arm64-v8a
-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=/Users/admin/code/app/node_modules/react-native-reanimated/android/build/intermediates/cxx/RelWithDebInfo/2u516l44/obj/arm64-v8a
-DCMAKE_BUILD_TYPE=RelWithDebInfo
-DCMAKE_FIND_ROOT_PATH=/Users/admin/code/app/node_modules/react-native-reanimated/android/.cxx/RelWithDebInfo/2u516l44/prefab/arm64-v8a/prefab
-B/Users/admin/code/app/node_modules/react-native-reanimated/android/.cxx/RelWithDebInfo/2u516l44/arm64-v8a
-GNinja
-DANDROID_STL=c++_shared
-DREACT_NATIVE_MINOR_VERSION=71
-DANDROID_TOOLCHAIN=clang
-DREACT_NATIVE_DIR=/Users/admin/code/app/node_modules/react-native
-DJS_RUNTIME=hermes
-DJS_RUNTIME_DIR=/Users/admin/code/app/node_modules/react-native/sdks/hermes
-DCLIENT_SIDE_BUILD=true
-DIS_NEW_ARCHITECTURE_ENABLED=false
-DIS_REANIMATED_EXAMPLE_APP=false
-DPLAYGROUND_APP_NAME=app
-DREANIMATED_PACKAGE_BUILD=null
-DREANIMATED_VERSION=3.2.0
-DHERMES_ENABLE_DEBUGGER=0
Starting process ‘command ‘/Users/admin/Library/Android/sdk/cmake/3.18.1/bin/cmake’’. Working directory: /Users/admin/code/app/node_modules/react-native-reanimated/android Command: /Users/admin/Library/Android/sdk/cmake/3.18.1/bin/cmake -H/Users/admin/code/app/node_modules/react-native-reanimated/android -DCMAKE_SYSTEM_NAME=Android -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_SYSTEM_VERSION=26 -DANDROID_PLATFORM=android-26 -DANDROID_ABI=arm64-v8a -DCMAKE_ANDROID_ARCH_ABI=arm64-v8a -DANDROID_NDK=/Users/admin/Library/Android/sdk/ndk/23.1.7779620 -DCMAKE_ANDROID_NDK=/Users/admin/Library/Android/sdk/ndk/23.1.7779620 -DCMAKE_TOOLCHAIN_FILE=/Users/admin/Library/Android/sdk/ndk/23.1.7779620/build/cmake/android.toolchain.cmake -DCMAKE_MAKE_PROGRAM=/Users/admin/Library/Android/sdk/cmake/3.18.1/bin/ninja -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/Users/admin/code/app/node_modules/react-native-reanimated/android/build/intermediates/cxx/RelWithDebInfo/2u516l44/obj/arm64-v8a -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=/Users/admin/code/app/node_modules/react-native-reanimated/android/build/intermediates/cxx/RelWithDebInfo/2u516l44/obj/arm64-v8a -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_FIND_ROOT_PATH=/Users/admin/code/app/node_modules/react-native-reanimated/android/.cxx/RelWithDebInfo/2u516l44/prefab/arm64-v8a/prefab -B/Users/admin/code/app/node_modules/react-native-reanimated/android/.cxx/RelWithDebInfo/2u516l44/arm64-v8a -GNinja -DANDROID_STL=c++_shared -DREACT_NATIVE_MINOR_VERSION=71 -DANDROID_TOOLCHAIN=clang -DREACT_NATIVE_DIR=/Users/admin/code/app/node_modules/react-native -DJS_RUNTIME=hermes -DJS_RUNTIME_DIR=/Users/admin/code/app/node_modules/react-native/sdks/hermes -DCLIENT_SIDE_BUILD=true -DIS_NEW_ARCHITECTURE_ENABLED=false -DIS_REANIMATED_EXAMPLE_APP=false -DPLAYGROUND_APP_NAME=app -DREANIMATED_PACKAGE_BUILD=null -DREANIMATED_VERSION=3.2.0 -DHERMES_ENABLE_DEBUGGER=0 C/C++: /Users/admin/code/app/node_modules/react-native-reanimated/android/CMakeLists.txt release|arm64-v8a : JSON generation completed with problem. Exception: org.gradle.process.internal.ExecException: A problem occurred starting process ‘command ‘/Users/admin/Library/Android/sdk/cmake/3.18.1/bin/cmake’’ C/C++: /Users/admin/code/app/node_modules/react-native-reanimated/android/CMakeLists.txt release|arm64-v8a : Writing build model to /Users/admin/code/app/node_modules/react-native-reanimated/android/build/intermediates/cxx/RelWithDebInfo/2u516l44/logs/arm64-v8a/build_model.json :react-native-reanimated:configureCMakeRelWithDebInfo[arm64-v8a] (Thread[Execution worker Thread 4,5,main]) completed. Took 0.216 secs.
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
have you found any solution ? I’m receiving the same error
Steps worked for me:
this has worked for me
Same exact issue, builds fine locally but fails on AppCenter
Execution failed for task ':react-native-reanimated:configureCMakeRelWithDebInfo[arm64-v8a]'.
I retested with 3.3.0 - same issues.
Any updates on this? I have the same problem on react native 0.71.8 with Reanimated 3.3.0 and Gradle plugin 7.4.2 (and Gradle 7.5.1). The problem only occurs on CI, not when building on my Mac.
So i downgraded to
v2.17.0
and my build in the CI is working again. I know, this is not really a “fix”, but it might help to take a deeper look into the changes between these versions. If you need more infos, I’m glad if you reach out.Did you resolve it ?
the react native reanimated plugin was not set correctly in babel.config.js. it’s work for me.
I am having the same issue. Tried upgrading Gradle/Gradle Build (both versions, as suggested above) and using React Native 0.72.4, as well as React-native-reanimated 3.4.2. Can’t get it to build anywhere.
I’ve upgraded to 3.3.0. And it seems to work for me now
Damn I forgot to run ios, I faced the same error like you @aliza-khu
Same to me, build local is fine but failed on circleci, not sure due to anything cached
I got the same error running:
upgrade to
react-native-reanimated: 3.3.0
and executeyarn start --reset-cache
solved the problem for me