Skip to content

Fix "NDK did not have a source.properties file" Error

This comprehensive guide explains how to resolve the common Android development error where the NDK is missing the source.properties file, preventing your project from building successfully.

Problem Overview

The error occurs when Android Studio's build system cannot locate or validate the Native Development Kit (NDK) installation. The specific error message is:

Execution failed for task ':app:stripDebugDebugSymbols'.
NDK at ~/Library/Android/sdk/ndk-bundle did not have a source.properties file

This typically happens because:

  • The NDK installation is incomplete or corrupted
  • The NDK path referenced in your project doesn't exist
  • There's a mismatch between the expected and actual NDK versions
  • The ndk-bundle directory is outdated or missing required files

Primary Solutions

Solution 1: Install or Reinstall NDK via Android Studio

The most reliable fix is to ensure you have a properly installed NDK version:

  1. Open Android Studio SDK Manager:

    • Go to File → Settings (Windows/Linux) or Android Studio → Preferences (macOS)
    • Navigate to Appearance & Behavior → System Settings → Android SDK
    • Select the SDK Tools tab
  2. Install NDK:

    • Check the box for NDK (Side by side)
    • Click Show Package Details (bottom right)
    • Select a stable NDK version (recommended: 26.1.10909125 or later)
    • Click Apply and OK to install

INFO

Some projects, particularly Expo/React Native, may have compatibility issues with newer NDK versions. Version 26.1.10909125 is known to be stable for many use cases.

Solution 2: Specify NDK Version in build.gradle

Once you have installed the NDK, explicitly define the version in your module's build.gradle file:

groovy
android {
    compileSdkVersion 33
    ndkVersion "26.1.10909125" // Use your installed version
    // Other configuration...
}

WARNING

Ensure the version number matches exactly what you installed through the SDK Manager. You can find this in your SDK directory under ~/Library/Android/sdk/ndk/ (macOS) or C:\Users\username\AppData\Local\Android\Sdk\ndk\ (Windows).

Solution 3: Clean Up NDK Directories

If you have corrupted or incomplete NDK installations:

  1. Navigate to your Android SDK's NDK directory:

    • macOS: ~/Library/Android/sdk/ndk/
    • Windows: C:\Users\username\AppData\Local\Android\Sdk\ndk\
  2. Remove problematic NDK versions (particularly the one mentioned in your error):

bash
# Example for macOS
cd ~/Library/Android/sdk/ndk/
rm -rf 25.1.8937393  # Replace with your problematic version
  1. Reinstall the NDK through Android Studio as described in Solution 1.

Solution 4: Update Local Properties File

The local.properties file may contain outdated NDK references:

  1. Open android/local.properties in your project
  2. Remove or update the ndk.dir property:
properties
# Remove this line entirely (recommended)
# ndk.dir=~/Library/Android/sdk/ndk-bundle

# Or update to point to a specific NDK version
ndk.dir=/Users/username/Library/Android/sdk/ndk/26.1.10909125

DANGER

The ndk-bundle directory is deprecated. Modern Android development should use side-by-side NDK versions instead.

Additional Troubleshooting Steps

Accept Android Licenses

If you're using Flutter or other cross-platform tools, ensure Android licenses are accepted:

bash
flutter doctor --android-licenses

Press y to accept all licenses when prompted.

Clean and Rebuild Project

After making changes, clean your project:

bash
# For Android projects
./gradlew clean

# For Flutter projects
flutter clean

Then rebuild your project.

Verify NDK Installation

Check that your NDK installation contains the required files, including source.properties. A complete NDK directory should look similar to:

ndk/26.1.10909125/
├── build/
├── meta/
├── ndk-build
├── ndk-gdb
├── ndk-stack
├── ndk-which
├── notice.html
├── package.xml
├── python-packages/
├── shader-tools/
├── simpleperf/
├── source.properties  # This file must exist
├── sysroot/
├── toolchains/
└── wrap.sh

Common Scenarios

React Native/Expo Projects

For React Native and Expo projects, NDK compatibility is crucial. Follow these specific steps:

  1. Install NDK version 26.1.10909125 through Android Studio
  2. Specify this exact version in android/app/build.gradle:
groovy
android {
    ndkVersion "26.1.10909125"
}
  1. Remove any ndk.dir references from local.properties

Flutter Projects

Flutter projects may require additional configuration:

  1. Run flutter doctor to check for any Android license issues
  2. Add NDK version to android/app/build.gradle:
groovy
android {
    defaultConfig {
        ndkVersion "26.1.10909125"
    }
}
  1. Run flutter clean before rebuilding

Prevention

To avoid this issue in the future:

  1. Always install NDK through Android Studio's SDK Manager rather than manual downloads
  2. Specify NDK versions explicitly in your build.gradle files
  3. Avoid modifying the ndk.dir property in local.properties unless necessary
  4. Regularly update your NDK installations through the SDK Manager

Conclusion

The "NDK did not have a source.properties file" error typically indicates an incomplete or misconfigured NDK installation. By following the solutions outlined above—installing the correct NDK version, specifying it in your build configuration, and cleaning up outdated references—you can resolve this issue and continue developing your Android application successfully.