Skip to content

[Android] Build fails on Flutter 3.38.5: "Android NDK Clang could not be found" #180163

Description

@MatteoBax

Steps to reproduce

Build the project with flutter build apk --release

Expected results

The APK generation.

Actual results

The command flutter build apk --release fails with: Android NDK Clang could not be found..
The problem does not occur if I remove the cupertino_http dependency or use Flutter version 3.35.7.

Code sample

Since the code for this issue is irrelevant, I'm attaching the pubspec.yaml.

pubspec.yaml
name: prova_deps
description: "A new Flutter project."
# The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev

# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.0.0+1

environment:
  sdk: ^3.9.2

# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions
# consider running `flutter pub upgrade --major-versions`. Alternatively,
# dependencies can be manually updated by changing the version numbers below to
# the latest version available on pub.dev. To see which dependencies have newer
# versions available, run `flutter pub outdated`.
dependencies:
  flutter:
    sdk: flutter

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^1.0.8
  http: ^1.6.0
  provider: ^6.1.5
  auto_scroll_text: ^0.0.7
  cupertino_http: ^2.4.0
  dio: ^5.9.0
  cookie_jar: ^4.0.8
  dio_cookie_manager: ^3.3.0
  shared_preferences: ^2.5.4
  simple_dns_client:
    path: "/media/matteo/Dati/dart projects/simple_dns_client"
  package_info_plus: ^9.0.0
  synchronized: ^3.4.0
  reorderables: ^0.6.0
  audio_service: ^0.18.18
  taudio: ^10.3.8
  fluttertoast: ^9.0.0
  crypto: ^3.0.6
  sqflite: ^2.4.2
  path_provider: ^2.1.5
  mutex: ^3.1.0
  flutter_image_cache: ^1.0.2
  objectbox_flutter_libs: ^5.1.0
  objectbox: ^5.1.0

dev_dependencies:
  flutter_test:
    sdk: flutter

  # The "flutter_lints" package below contains a set of recommended lints to
  # encourage good coding practices. The lint set provided by the package is
  # activated in the `analysis_options.yaml` file located at the root of your
  # package. See that file for information about deactivating specific lint
  # rules and activating additional ones.
  flutter_lints: ^6.0.0

# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

# The following section is specific to Flutter packages.
flutter:

  # The following line ensures that the Material Icons font is
  # included with your application, so that you can use the icons in
  # the material Icons class.
  uses-material-design: true

  # To add assets to your application, add an assets section, like this:
  # assets:
  #   - images/a_dot_burr.jpeg
  #   - images/a_dot_ham.jpeg

  # An image asset can refer to one or more resolution-specific "variants", see
  # https://flutter.dev/to/resolution-aware-images

  # For details regarding adding assets from package dependencies, see
  # https://flutter.dev/to/asset-from-package

  # To add custom fonts to your application, add a fonts section here,
  # in this "flutter" section. Each entry in this list should have a
  # "family" key with the font family name, and a "fonts" key with a
  # list giving the asset and other descriptors for the font. For
  # example:
  # fonts:
  #   - family: Schyler
  #     fonts:
  #       - asset: fonts/Schyler-Regular.ttf
  #       - asset: fonts/Schyler-Italic.ttf
  #         style: italic
  #   - family: Trajan Pro
  #     fonts:
  #       - asset: fonts/TrajanPro.ttf
  #       - asset: fonts/TrajanPro_Bold.ttf
  #         weight: 700
  #
  # For details regarding fonts from package dependencies,
  # see https://flutter.dev/to/font-from-package

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

output.log

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.38.5, on Debian GNU/Linux 13 (trixie)
    6.12.57+deb13-amd64, locale it_IT.UTF-8) [399ms]
    • Flutter version 3.38.5 on channel stable at /home/matteo/sdk/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision f6ff1529fd (9 giorni fa), 2025-12-11 11:50:07 -0500
    • Engine revision 1527ae0ec5
    • Dart version 3.10.4
    • DevTools version 2.51.1
    • Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop,
      enable-windows-desktop, enable-android, enable-ios, cli-animations,
      enable-native-assets, omit-legacy-version-file, enable-lldb-debugging

[✓] Android toolchain - develop for Android devices (Android SDK version 36.0.0)
    [10,0s]
    • Android SDK at /home/matteo/sdk/android
    • Emulator version 36.3.10.0 (build_id 14472402) (CL:N/A)
    • Platform android-36, build-tools 36.0.0
    • Java binary at: /snap/android-studio/209/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 [59ms]
    • Chrome at google-chrome

[✓] Linux toolchain - develop for Linux desktop [1.480ms]
    • Debian clang version 19.1.7 (3+b1)
    • cmake version 3.31.6
    • ninja version 1.12.1
    • pkg-config version 1.8.1
    • OpenGL core renderer: Mesa Intel(R) UHD Graphics (CML GT2) (X11)
    • OpenGL core version: 4.6 (Core Profile) Mesa 25.0.7-2 (X11)
    • OpenGL core shading language version: 4.60 (X11)
    • OpenGL ES renderer: Mesa Intel(R) UHD Graphics (CML GT2) (X11)
    • OpenGL ES version: OpenGL ES 3.2 Mesa 25.0.7-2 (X11)
    • OpenGL ES shading language version: OpenGL ES GLSL ES 3.20 (X11)
    • GL_EXT_framebuffer_blit: yes (X11)
    • GL_EXT_texture_format_BGRA8888: yes (X11)

[✓] Connected device (2 available) [619ms]
    • Linux (desktop) • linux  • linux-x64      • Debian GNU/Linux 13 (trixie)
      6.12.57+deb13-amd64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 143.0.7499.169

[✓] Network resources [1.765ms]
    • All expected network resources are available.

• No issues found!

Activity

  1. tirth-patel-nc commented on Dec 22, 2025

    @tirth-patel-nc
    Member

    @MatteoBax thanks for the report. Since it is specific to that package I recommend filing it https://github.com/dart-lang/http/issues. We can take a look if you're redirected here.

    Also that package is specific to iOS/macOS.

  2. added
    r: invalidIssue is closed as not valid
    and removed
    in triagePresently being triaged by the triage team
    on Dec 22, 2025
  3. brianquinlan commented on Dec 22, 2025

    @brianquinlan
    Contributor

    From @dcharkes (dart-lang/http#1867 (comment)):

    Thanks for the report @MatteoBax!

    Yes, this an error from Flutter tools.

    I see flutter doctor is not in line with what's need for build hooks, we also need an Android NDK as part the Android SDK.

    Please file an issue on the Flutter repo with a proposed solution.

    Two parts of a solution:

    Make flutter doctor complain about the NDK missing.
    Don't error on a missing NDK, but pass null to the CCompilerConfig that is passed to the build hook.
    (We did a similar change to address #178715, though there we do always require a clang for running on Linux desktop because you need clang anyway to compile your app.)

  4. added
    c: crashStack traces logged to the console
    platform-androidAndroid applications specifically
    toolAffects the "flutter" command-line tool. See also t: labels.
    a: releaseChallenges faced when attempting to productionize an app
    team-androidOwned by Android platform team
    fyi-toolFor the attention of Flutter Tool team
    c: fatal crashCrashes that terminate the process
    and removed
    r: invalidIssue is closed as not valid
    on Dec 23, 2025
  5. 11 remaining items

  6. MatteoBax commented on Jan 9, 2026

    @MatteoBax
    Author
    • is there a previous version of 3.38 that does not have this issue?

    I’m not experiencing this issue with the cupertino_http package on Flutter 3.35.7

  7. dklenowski commented on Jan 15, 2026

    @dklenowski

    This was happening to me on Flutter 3.38.6/Windows. Fixed it by unsetting the environment variable ANDROID_NDK_HOME .. not sure why.

  8. ValeriusGC commented on Jan 15, 2026

    @ValeriusGC

    In my case sentry_flutter was a foe ))
    sentry_flutter: 9.8.0 works well
    but
    sentry_flutter: ^9.9.2 - crash my build

     flutter doctor -v
    [✓] Flutter (Channel stable, 3.38.7, on macOS 15.7.1 24G231 darwin-arm64, locale en-GB) [1,104ms]
        • Flutter version 3.38.7 on channel stable at /usr/local/Caskroom/flutter/1.22.6/flutter
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision 3b62efc2a3 (2 days ago), 2026-01-13 13:47:42 -0800
        • Engine revision 78fc3012e4
        • Dart version 3.10.7
        • DevTools version 2.51.1
        • Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios, cli-animations,
          enable-native-assets, omit-legacy-version-file, enable-lldb-debugging
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 36.1.0) [11.3s]
        • Android SDK at /Users/vvk/Library/Android/sdk
        • Emulator version 36.3.10.0 (build_id 14472402) (CL:N/A)
        • Platform android-36, build-tools 36.1.0
        • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/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.8+-14196175-b1038.72)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 16.3) [2.7s]
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • Build 16E140
        • CocoaPods version 1.16.2
    
    [✓] Chrome - develop for the web [9ms]
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] Connected device (2 available) [6.0s]
        • macOS (desktop) • macos  • darwin-arm64   • macOS 15.7.1 24G231 darwin-arm64
        • Chrome (web)    • chrome • web-javascript • Google Chrome 143.0.7499.193
        ! Error: Browsing on the local area network for iPhone (Frostyland). Ensure the device is unlocked and attached with a cable or associated with the
          same local area network as this Mac.
          The device must be opted into Developer Mode to connect wirelessly. (code -27)
    
    [✓] Network resources [20.9s]        
        • All expected network resources are available.
    
    • No issues found!
    
  9. EvertJanDeBruin commented on Jan 16, 2026

    @EvertJanDeBruin

    I got the same issue, but do not have cupertino_http, sentry_flutter or ANDROID_NDK_HOME .

    Any recommended fixes? I have downgraded to "resolve" this.

    Update: i was integrating melos for my packages at the same time, apparently (somehow) this was the cause. Downgrading to an older flutter release dit not solve my problem, removing melos did.

  10. dcharkes commented on Jan 16, 2026

    @dcharkes
    Contributor

    @EvertJanDeBruin I've landed a fix on main #180594, does switching to the main channel resolve your issue? (It might also already be in the latest beta.)

  11. adlyyy4 commented on Jan 19, 2026

    @adlyyy4

    I was having the same issue my solution was
    Install the Android NDK through Android Studio:

    1. Open Android Studio
    2. Go to Tools → SDK Manager
    3. Click the SDK Tools tab
    4. Check NDK (Side by side)
  12. alexlapa commented on Jan 19, 2026

    @alexlapa

    Switching to main fixed this issue for me.

  13. reidbaker commented on Jan 26, 2026

    @reidbaker
    Contributor

    @dcharkes is there something we can cherry pick into the 3.41 beta (the next stable)

    Confirmed the linked pr is in 3.41 which is a beta but will be the next stable. ETA sometime in feb 2026

    git branch -r --contains a0a2783 | grep flutter-
      origin/flutter-3.41-candidate.0
    
  14. moodless3 commented on Jan 28, 2026

    @moodless3

    switch to beta channel . then apply upgrade , it will avoid this issue for sure . other work arounds wont

  15. jake-johnson-disney commented on Feb 2, 2026

    @jake-johnson-disney

    in our case we hit this issue in our GitHub Actions workflow on ubuntu-latest. The root cause was our disk cleanup step was deleting the pre-installed NDK:

    # This breaks Flutter 3.38.x builds:
    
    sudo rm -rf /usr/local/lib/android/sdk/ndk || true
    

    The NDK is pre-installed on GitHub's ubuntu-latest runners, and Flutter 3.38.x needs it for native asset compilation. While Flutter can auto-install the NDK via sdkmanager, removing the entire /ndk directory before the build causes this failure.

    Fix options:

    Don't delete the NDK directory in cleanup steps
    If you must free disk space, only delete specific old NDK versions you don't need
    Explicitly reinstall the required NDK after cleanup:

    echo "y" | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --install "ndk;YOUR_VERSION"

    This may help others seeing this error only in CI but not locally.

  16. westito commented on Feb 10, 2026

    @westito
    Contributor

    The only one working solution I found was adding "android-ndk": "{{Your android SDK dir}}/sdk/ndk/28.2.13676358", to ~/.config/flutter/settings file

  17. xlk777 commented on Mar 5, 2026

    @xlk777

    export ANDROID_NDK_HOME=your ndk home

  18. Mind-Reaper-Shuk commented on Mar 23, 2026

    @Mind-Reaper-Shuk

    I solved by deleting all folders of ndk higher than the one you intend to use.

    e.g I wanted to use 29.0.14206865 , so I deleted existing folders of ndk 30

    Path to see all ndk

    /Android/sdk/ndk/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: buildBuilding flutter applications with the toola: releaseChallenges faced when attempting to productionize an appc: crashStack traces logged to the consolec: fatal crashCrashes that terminate the processfyi-toolFor the attention of Flutter Tool teamplatform-androidAndroid applications specificallyt: flutter doctorProblem related to the "flutter doctor" toolteam-androidOwned by Android platform teamtoolAffects the "flutter" command-line tool. See also t: labels.triaged-androidTriaged by Android platform team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions