Skip to content

Flutter's Android tools ignore NDK symlinks and copy files instead, leading to huge disk usage #177286

Closed

Description

@bc-lee

While investigating disk space shortages, I discovered that Flutter’s Android tools package includes a large NDK copy where all symlinks have been resolved into actual files.

Normal NDK from the official Android site:

[/path/to/ndk/28.2.13676358/toolchains/llvm/prebuilt/linux-x86_64/bin]$ ls -al | grep ^l
lrwxrwxrwx.  1 user user         8 Jul 27 07:59 clang -> clang-19
lrwxrwxrwx.  1 user user         5 Jul 27 07:59 clang++ -> clang
lrwxrwxrwx.  1 user user         6 Jul 27 07:59 ld -> ld.lld
lrwxrwxrwx.  1 user user         3 Jul 27 07:59 ld64.lld -> lld
lrwxrwxrwx.  1 user user         3 Jul 27 07:59 ld.lld -> lld
lrwxrwxrwx.  1 user user         3 Jul 27 07:59 lld-link -> lld
lrwxrwxrwx.  1 user user        15 Jul 27 07:59 llvm-addr2line -> llvm-symbolizer
lrwxrwxrwx.  1 user user         7 Jul 27 07:59 llvm-dlltool -> llvm-ar
lrwxrwxrwx.  1 user user         7 Jul 27 07:59 llvm-lib -> llvm-ar
lrwxrwxrwx.  1 user user         7 Jul 27 07:59 llvm-ranlib -> llvm-ar
lrwxrwxrwx.  1 user user        12 Jul 27 07:59 llvm-readelf -> llvm-readobj
lrwxrwxrwx.  1 user user        12 Jul 27 07:59 llvm-strip -> llvm-objcopy
lrwxrwxrwx.  1 user user         7 Jul 27 07:59 llvm-windres -> llvm-rc
lrwxrwxrwx.  1 user user         3 Jul 27 07:59 wasm-ld -> lld

NDK bundled with Flutter’s Android tools:

[/path/to/flutter/engine/src/flutter/third_party/android_tools/ndk/toolchains/llvm/prebuilt/linux-x86_64/bin]$ ls -al | grep ^l
[/path/to/flutter/engine/src/flutter/third_party/android_tools/ndk/toolchains/llvm/prebuilt/linux-x86_64/bin]$ ls -al clang*
-r-xr-xr-x. 1 user user 135276024 Oct  2 04:29 clang
-r-xr-xr-x. 1 user user 135276024 Oct  2 04:29 clang++
-r-xr-xr-x. 1 user user 135276024 Oct  2 04:29 clang-19
-r-xr-xr-x. 1 user user  75759408 Oct  2 04:29 clang-check
-r-xr-xr-x. 1 user user  44910272 Oct  2 04:29 clangd
-r-xr-xr-x. 1 user user   3817168 Oct  2 04:29 clang-format
-r-xr-xr-x. 1 user user  75664920 Oct  2 04:29 clang-scan-deps
-r-xr-xr-x. 1 user user  53089504 Oct  2 04:29 clang-tidy

As shown above, clang, clang++, and clang-19 are all separate files of ~135 MB each.
In the official NDK, they are symlinks to the same file.

This means Flutter’s Android tools are effectively duplicating large binaries, inflating the NDK’s size by hundreds (if not thousands) of megabytes.

Expected behavior

NDK binaries in Flutter’s Android tools should preserve symlinks instead of copying file contents.
This would significantly reduce disk usage and improve developer experience.

Environment

Activity

  1. added
    in triagePresently being triaged by the triage team
    on Oct 21, 2025
  2. huycozy commented on Oct 21, 2025

    @huycozy
    Member

    Hi @bc-lee
    To be clear, does this issue only happen when compiling engine for Android?

  3. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Oct 21, 2025
  4. bc-lee commented on Oct 21, 2025

    @bc-lee
    ContributorAuthor

    I think this happens even when I don’t compile for Android.
    For reference, the .gclient file of my machine is the unmodified one.

    $ cat .gclient
    # Copy this file to the root of your Flutter checkout to bootstrap gclient
    # or just run "gclient sync" in an empty directory with this file.
    solutions = [
      {
        "custom_deps": {},
        "deps_file": "DEPS",
        "managed": False,
        "name": ".",
        "safesync_url": "",
    
        # If you are using SSH to connect to GitHub, change the URL to:
        # [email protected]:flutter/flutter.git
        "url": "https://github.com/flutter/flutter.git",
    
        # Uncomment the custom_vars section below if you plan to build the web engine.
        # "custom_vars": {
        #   "download_emsdk": True,
        # },
      },
    ]
  5. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Oct 21, 2025
  6. huycozy commented on Oct 22, 2025

    @huycozy
    Member

    Thanks for confirming it. Labeling this for further insights.

  7. added
    platform-androidAndroid applications specifically
    team-androidOwned by Android platform team
    toolAffects the "flutter" command-line tool. See also t: labels.
    and removed
    in triagePresently being triaged by the triage team
    on Oct 22, 2025
  8. added
    fyi-androidFor the attention of Android platform team
    fyi-infraFor the attention of Infrastructure team
    and removed
    team-androidOwned by Android platform team
    on Oct 22, 2025
  9. reidbaker commented on Oct 22, 2025

    @reidbaker
    Contributor

    @gaaclarke or @chinmaygarde is this something the engine team can take a look at? It feels like a gclient configuration thing not a android tooling thing. My guess is that any symlink would copy.

  10. 10 remaining items

  11. added
    team-androidOwned by Android platform team
    P2Important issues not at the top of the work list
    triaged-androidTriaged by Android platform team
    and removed
    team-infraOwned by Infrastructure team
    fyi-androidFor the attention of Android platform team
    on Oct 28, 2025
  12. gmackall commented on Oct 28, 2025

    @gmackall
    Member

    Confirmed that the symlinks are preserved with the above change, will request CIPD access and update the bundle

  13. gmackall commented on Oct 29, 2025

    @gmackall
    Member

    Confirmed that the symlinks are preserved with the above change, will request CIPD access and update the bundle

    Having some mechanical trouble getting CIPD access, will upload the bundle when that gets sorted out

  14. added
    r: fixedIssue is closed as already fixed in a newer version
    on Oct 30, 2025
  15. github-actions commented on Nov 13, 2025

    @github-actions

    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 -v and a minimal reproduction of the issue.

  16. locked as resolved and limited conversation to collaborators on Nov 13, 2025
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 listfyi-infraFor the attention of Infrastructure teamplatform-androidAndroid applications specificallyr: fixedIssue is closed as already fixed in a newer versionteam-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