Repository navigation
Closed
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listfound in release: 3.35Found to occur in 3.35Found to occur in 3.35found in release: 3.37Found to occur in 3.37Found to occur in 3.37has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onplatform-androidAndroid applications specificallyAndroid applications specificallyt: gradle"flutter build" and "flutter run" on Android"flutter build" and "flutter run" on Androidteam-androidOwned by Android platform teamOwned by Android platform teamtoolAffects the "flutter" command-line tool. See also t: labels.Affects the "flutter" command-line tool. See also t: labels.triaged-androidTriaged by Android platform teamTriaged by Android platform team
Description
Steps to reproduce
- Create a new Flutter project for Android using
flutter create ndk_build_sample --platforms=android. - In
android/app/build.gradle.ktsfile, add an external native build usingndk-build:
externalNativeBuild {
ndkBuild {
path = file("src/main/cpp/Android.mk") // This can point to an empty file for repro purposes
}
}
- In Android Studio, click on "Sync Project With Gradle Files".
Expected results
The Gradle sync succeeds, and the ndk-build file is included in the build process as expected.
Alternatively, if ndk-build is not supported in Flutter apps, this should produce a clearer error.
Actual results
Gradle configuration fails for :app with the following error:
> Configure project :app
[CXX1400] More than one externalNativeBuild path specified
[CXX1400] More than one externalNativeBuild path specified
[CXX1400] More than one externalNativeBuild path specified
Code sample
Sample project: https://github.com/TheLastBanana/ndk_build_sample
Screenshots or Video
No response
Logs
No response
Flutter Doctor output
Doctor output
[√] Flutter (Channel stable, 3.35.4, on Microsoft Windows [Version 10.0.26100.6584], locale en-CA) [279ms]
• Flutter version 3.35.4 on channel stable at G:\flutter_3.35.x
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision d693b4b9db (8 days ago), 2025-09-16 14:27:41 +0000
• Engine revision c298091351
• Dart version 3.9.2
• DevTools version 2.48.0
• Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android,
enable-ios, cli-animations, enable-lldb-debugging
[√] Windows Version (Windows 11 or higher, 24H2, 2009) [795ms]
[√] Android toolchain - develop for Android devices (Android SDK version 36.0.0) [2.5s]
• Android SDK at E:\Android\Sdk
• Emulator version 36.1.9.0 (build_id 13823996) (CL:N/A)
• Platform android-36, build-tools 36.0.0
• Java binary at: E:\Program Files\Android\Android Studio\jbr\bin\java
This is the JDK bundled with the latest Android Studio installation on this machine.
To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
• Java version OpenJDK Runtime Environment (build 21.0.7+-13880790-b1038.58)
• All Android licenses accepted.
[√] Chrome - develop for the web [95ms]
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.14.10) [94ms]
• Visual Studio at E:\Program Files\Microsoft Visual Studio\2022\Community
• Visual Studio Community 2022 version 17.14.36327.8
• Windows 10 SDK version 10.0.26100.0
[√] Android Studio (version 2025.1.3) [12ms]
• Android Studio at E:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 21.0.7+-13880790-b1038.58)
[√] Connected device (3 available) [150ms]
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.26100.6584]
• Chrome (web) • chrome • web-javascript • Google Chrome 140.0.7339.128
• Edge (web) • edge • web-javascript • Microsoft Edge 140.0.3485.81
[√] Network resources [593ms]
• All expected network resources are available.
• No issues found!Reacted by Asif Tonim
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listfound in release: 3.35Found to occur in 3.35Found to occur in 3.35found in release: 3.37Found to occur in 3.37Found to occur in 3.37has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onplatform-androidAndroid applications specificallyAndroid applications specificallyt: gradle"flutter build" and "flutter run" on Android"flutter build" and "flutter run" on Androidteam-androidOwned by Android platform teamOwned by Android platform teamtoolAffects the "flutter" command-line tool. See also t: labels.Affects the "flutter" command-line tool. See also t: labels.triaged-androidTriaged by Android platform teamTriaged by Android platform team
Activity
TheLastBanana commentedon Sep 24, 2025
If I comment out the call to
FlutterPluginUtils.forceNdkDownloadinFlutterPlugin.apply, the app builds as expected. It looks like that function has an early out if the project has an existing CMake build, but if the project usesndk-build, it adds the extra build anyway, leading to multiple external native builds.darshankawar commentedon Sep 25, 2025
Thanks for the report. I was able to replicate the reported behavior on latest stable and master versions which throws below error upon running
./gradlew syncinsideandroidfolder:1 remaining item
gmackall commentedon Oct 1, 2025
It looks like unfortunately the configuration we use to make AGP download the NDK conflicts with your ndk-build config, because AGP doesn't allow mixing ndk-build and cmake
https://issuetracker.google.com/issues/120166563
We will need to find a way to make this configuration happen late enough in Gradle's lifecycle that we can detect if the user is configuring either ndk-build or cmake, or otherwise provide a flag to disable the configuration we are doing in
forceNdkDownloadhttps://github.com/flutter/flutter/blob/master/packages/flutter_tools/gradle/src/main/kotlin/FlutterPluginUtils.kt#L588
flutter-triage-bot commentedon Feb 5, 2026
This issue is assigned to @gmackall but has had no recent status updates. Please consider unassigning this issue if it is not going to be addressed in the near future. This allows people to have a clearer picture of what work is actually planned. Thanks!
flutter-triage-bot commentedon Apr 22, 2026
This issue was assigned to @gmackall but has had no status updates in a long time. To remove any ambiguity about whether the issue is being worked on, the assignee was removed.
Resolve issue flutter#175968: forceNdkDownload should skip configurin…
forceNdkDownload should skip configuring cmake when ndk-build is used (…
github-actions commentedon Aug 6, 2026
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.