React Native, Android build failing because of missing CMakeLists.txt
Asked Answered
S

1

5

I'm trying to build my react native project for Android but I get this error.

FAILURE: Build completed with 2 failures. 

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:configureCMakeDebug[arm64-v8a]'.
> [CXX1409] [project folder]/android/app/.cxx/Debug/l1z3g258/arm64-v8a/android_gradle_build.json debug|arm64-v8a : expected buildFiles file '[project folder]/node_modules/react-native-screens/android/src/main/jni/CMakeLists.txt' to exist

* 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.
==============================================================================

2: Task failed with an exception.
-----------
* What went wrong:
java.lang.StackOverflowError (no error message)

* 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.

I get the same CMakeLists.txt missing error in Android Studio -> Build as well.

The library in the error, react-native-screens, was installed at one point but it is not something I'm using anymore. It is not part of my package.json file now. The only few references to this file that I can find in my project now is in the [project fodler]/android/app/.cxx/debug & [project fodler]/android/app/wef/debug folder. I'm not sure how to clean the reference here to not include libraries that are no longer installed in the project.

When I run ./gradlew clean inside android folder I run into the same issue again.

Schoolbook answered 11/4, 2023 at 10:45 Comment(5)
did u find any answers?Lewiss
@abdulsathar I just deleted the cxx folder and built it again. That worked. Not sure why but I have to keep deleting the cxx folder.Schoolbook
I found it is because u r using new architecture in React native project but some dependencies were missing from the new architecture installation. try to disable newArchEnabled=false or configure it better to work for new react native architecture.Lewiss
@abdulsathar I already have newArchEnabled=false in the project. That does not seem to stop the cxx folder creation though.Schoolbook
it is working for me, may be u can do some clean cacheLewiss
A
17

just remove android/app/.cxx folder and try to rebuild

Aggressor answered 3/6, 2023 at 0:5 Comment(4)
the folder doesn't exist.Sites
Thank you so much. I little bit stucked hereChoriamb
thanks. This worked for me. It was helpful after './gradlew clean' was stuck on the same error!Argentite
this works so wellApospory

© 2022 - 2024 — McMap. All rights reserved.