Introduction
Are you seeing a CMake build error while trying to run your React Native or Android project? Don’t worry—this is a common issue and usually stems from missing or misconfigured native development components such as the NDK, CMake, or Gradle settings.
In this guide, we’ll walk you through how to fix CMake build errors in both Android Studio and React Native CLI projects.
🚨 Common CMake Error Symptoms
You may encounter errors like:
CMake Error: Could not find CMAKE_ROOT
ShellCommandUnresponsiveException
Could not find cmake for ABI arm64-v8a
Build failed due to missing CMake toolchain
- Android build crashes after splash screen
🧰 Prerequisites Checklist
Before diving in, make sure:
- You have Android Studio installed
- Android SDK and Emulator are working
- You’re using a compatible version of React Native (if applicable)
✅ Step-by-Step Fix for CMake Build Error
Step 1: Install CMake and NDK in Android Studio
- Open Android Studio
- Go to File > Settings > Appearance & Behavior > System Settings > Android SDK
- Select SDK Tools
- Check:
- CMake
- NDK (Side by side)
- Click Apply and let it install.
Tip: Use NDK version
21.4.7075529
or23.1.7779620
for best compatibility with React Native.
Step 2: Clean and Rebuild Your Project
From your project root, run:

Step 3: Specify NDK Version (React Native Specific)
Edit android/gradle.properties
:

Step 4: Verify CMakeLists.txt
(If Using Native Modules)
If you’re integrating native libraries like react-native-reanimated
, react-native-camera
, or OpenCV, make sure your CMakeLists.txt
file is properly configured and error-free.
Example CMakeLists.txt
:

Step 5: Restart Emulator or Physical Device
Sometimes, your Android Emulator may hang or become unresponsive. Fix it by:
- Restarting the emulator
- Creating a new emulator from Android Studio (recommended)
Step 6: Enable Developer Mode (if crashing after splash screen)
If your app closes after the splash screen:
- Make sure Metro bundler is running:

- Enable Developer Mode in the app by:
- Pressing
Cmd + M
(macOS) orCtrl + M
(Windows/Linux) inside the emulator - Choose “Enable Remote Debugging”
- Pressing
🧪 Advanced Fix (Optional)
If the issue persists, try adding CMake manually in your android/app/build.gradle
:

Also, specify build tools and SDK versions that match your setup in build.gradle
.
📌 Conclusion
Fixing CMake build errors in Android Studio or React Native involves ensuring your development environment is properly configured. By installing the correct CMake and NDK versions, cleaning your project, and verifying native build paths, you can resolve most of these errors quickly.
If you’re still stuck, checking the Android build logs or Gradle error reports usually gives a clue to the root problem.
COMMENTS