Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Flutter and app store releases

Android build fails: Could not get unknown property 'ndkVersion' for extension 'flutter'

ErrorCould not get unknown property 'ndkVersion' for extension 'flutter' of type FlutterExtension

Short answer

The android/app/build.gradle file reads flutter.ndkVersion, but the Flutter Gradle plugin that Gradle loaded has no such property. Gradle takes that plugin from the SDK named in android/local.properties. Update that SDK, or point flutter.sdk at the SDK you actually run, or write an NDK version by hand.

  • Applies to Flutter 3.3x stable, Android Gradle Plugin 8.x, Gradle 8.x and 9.x, NDK installed through the Android SDK Manager
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Compare the Flutter SDK your terminal runs with the one the Android project is told to load. They must be the same folder.

    flutter --version
    which flutter
    grep flutter.sdk android/local.properties
  2. 2Match what you see, then jump to its fix

    1. 1The two paths from the first step differ, or the properties file names a folder that is an old copyflutter.sdk in local.properties points to another, older Flutter SDKFix
    2. 2Both paths match, and flutter --version shows a release older than the one that created the projectThe Flutter SDK you run is older than the project's Gradle filesFix
    3. 3Upgrading is not possible for this project or CI imageYou want the SDK as it is and need the build to pass nowFix

What does the error look like?

  • Could not get unknown property 'ndkVersion' for extension 'flutter' of type FlutterExtension

Cause 1 of 3

flutter.sdk in local.properties points to another, older Flutter SDK

1Check

Flutter's migration guide shows android/settings.gradle building the Gradle plugin from the folder written as flutter.sdk in local.properties. A project template that expects ndkVersion therefore breaks when that folder holds an older SDK.

grep flutter.sdk android/local.properties
flutter doctor -v | grep -i "Flutter version"

2Fix

Set flutter.sdk to the root of the SDK you run, the folder that contains bin, then clean.

# android/local.properties
flutter.sdk=/Users/me/develop/flutter

3Verify

Clean the project and build again.

flutter clean
flutter pub get
flutter build apk --debug

Confirmed by docs.flutter.dev

Did this fix it?

Cause 2 of 3

The Flutter SDK you run is older than the project's Gradle files

1Check

The Flutter Gradle plugin defines ndkVersion as a default for app projects; in current stable the value is a fixed NDK release chosen to match the Android Gradle plugin's default. An SDK without that property fails on the line that reads it.

flutter --version
grep -n "ndkVersion" android/app/build.gradle*

2Fix

Upgrade the SDK on the stable channel, as Flutter's upgrade guide describes, then clean and build.

flutter upgrade
flutter clean

3Verify

The Gradle evaluation of :app passes.

flutter build apk --debug

Confirmed by docs.flutter.dev

Did this fix it?

Cause 3 of 3

You want the SDK as it is and need the build to pass now

1Check

Android's docs let a module name its NDK version directly in the android block. That NDK has to be installed (NDK (Side by side) in SDK Manager).

ls "$ANDROID_HOME/ndk"

2Fix

Replace flutter.ndkVersion with a literal version that appears in the folder above.

// android/app/build.gradle
android {
    ndkVersion "27.0.12077973"   // example: use a version listed in $ANDROID_HOME/ndk
}

3Verify

Build the debug APK.

flutter build apk --debug

Confirmed by developer.android.com

Did this fix it?

How do I stop it coming back?

  • Check that flutter.sdk in android/local.properties names the SDK you run, whenever you move or reinstall Flutter.
  • Upgrade Flutter and regenerate the Android project files together, not one without the other.
  • Pin the Flutter version your team uses and print it in CI.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Mobile apps

Gradle says the Android namespace is not specified

A failure occurred while evaluating the project ':some_plugin'

Android Gradle Plugin 8 reads the package name for R and BuildConfig from the namespace property in the module's build file, not from the manifest.

3 causes, each with a fix

Mobile apps

Google Play says the app does not support 16 KB memory pages

check_elf_alignment.sh reports UNALIGNED for a library under lib/arm64-v8a

Google Play requires apps that target Android 15 or higher and ship native .so libraries to run on devices with 16 KB memory pages; from 1 February 2027 it will block updates that do not.

5 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.