Android build fails: Could not get unknown property 'ndkVersion' for extension 'flutter'
Could not get unknown property 'ndkVersion' for extension 'flutter' of type FlutterExtensionShort 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.
Fix it fast
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.properties2Match what you see, then jump to its fix
- 1
The 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
Both 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
Upgrading is not possible for this project or CI imageYou want the SDK as it is and need the build to pass nowFix
- 1
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/flutter3Verify
Clean the project and build again.
flutter clean
flutter pub get
flutter build apk --debugConfirmed by docs.flutter.dev
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 clean3Verify
The Gradle evaluation of :app passes.
flutter build apk --debugConfirmed by docs.flutter.dev
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 --debugConfirmed by developer.android.com
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:
- TaxiDexMy own multi-tenant taxi dispatch SaaS: API, dispatcher portal, driver and passenger apps, and the servers underneath.
- QistLockA NestJS and React SaaS driving an Android Device Owner agent that locks financed phones when payments lapse.
- Dispatch ProA real-time logistics platform: Flutter apps, Spring Boot services and a Kafka event pipeline on AWS.
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 fixMobile 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 fixMobile apps
Gradle cannot find com.google.firebase:firebase-analytics-ktx
Required by: project :app
Firebase moved the Kotlin extensions into the main modules and stopped releasing the -ktx modules in July 2025.
2 causes, each with a fixMobile apps
Gradle cannot create LibraryVariantBuilderImpl in a Flutter Android build
Could not create an instance of type com.android.build.api.variant.impl.LibraryVariantBuilderImpl
This error appears when the Android Gradle plugin (AGP) cannot run in the Gradle or IDE you use.
3 causes, each with a fixMobile apps
Flutter release build cannot open the keystore: HmacPBESHA256 not available
Algorithm HmacPBESHA256 not available
The keystore is a PKCS12 file protected by a newer algorithm than the Java that is reading it understands.
3 causes, each with a fixMobile apps
Android install error: the package conflicts with an existing package of the same name
The package conflicts with an existing package by the same name
Android allows only one app per application ID, and an update must be signed with the same certificate as the installed version.
3 causes, each with a fix