I created a React Native project using React Native 0.84.1.

When I run:

npx react-native run-android

the build fails with many C++ linker errors.

Environment:

React Native: 0.84.1

NDK version: 27.1.12297006

Android SDK: Installed

CMake: Installed

Error snippet:

error: undefined symbol: std::__ndk1::basic_string

error: undefined symbol: operator new

error: undefined symbol: __cxa_throw

It looks like a C++ linking issue related to NDK.

Is NDK 27 compatible with React Native 0.84?

What NDK version should be used?

Vijaysaichary Maroju's user avatar

1

Possible Reasons

Installed a new package Corrupted Gradle wrapper (gradlew)

Fix 1: Reinstall the package

Uninstall and reinstall the package properly:

npm install <package-name> --save

Fix 2: Clean and rebuild Android project

cd android && ./gradlew clean && ./gradlew installDebug

Note:

installDebug already builds the APK, so assembleDebug is not required.

Fix 3: Reset Gradle (if issues persist)

cd android && \ ./gradlew --stop && \ ./gradlew clean && \ rm -rf ~/.gradle/caches/ && \ rm -rf app/build && \ ./gradlew installDebug

Summary

Situation Command
Normal cleanup ./gradlew clean
Random build errors ./gradlew clean && ./gradlew installDebug
Dependency issues rm -rf ~/.gradle/caches/
Gradle stuck/hanging ./gradlew --stop
Completely broken build Full reset (commands above)

Abhiram010's user avatar

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.