Repository navigation
Flutter's Android tools ignore NDK symlinks and copy files instead, leading to huge disk usage #177286
Copy link
Copy link
Closed
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listfyi-infraFor the attention of Infrastructure teamFor the attention of Infrastructure teamplatform-androidAndroid applications specificallyAndroid applications specificallyr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-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
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 -> lldNDK 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-tidyAs 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
- Flutter version: 9dff19e
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listfyi-infraFor the attention of Infrastructure teamFor the attention of Infrastructure teamplatform-androidAndroid applications specificallyAndroid applications specificallyr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-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
huycozy commentedon Oct 21, 2025
Hi @bc-lee
To be clear, does this issue only happen when compiling engine for Android?
bc-lee commentedon Oct 21, 2025
I think this happens even when I don’t compile for Android.
For reference, the
.gclientfile of my machine is the unmodified one.huycozy commentedon Oct 22, 2025
Thanks for confirming it. Labeling this for further insights.
reidbaker commentedon Oct 22, 2025
@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 remaining items
gmackall commentedon Oct 28, 2025
Confirmed that the symlinks are preserved with the above change, will request CIPD access and update the bundle
gmackall commentedon Oct 29, 2025
Having some mechanical trouble getting CIPD access, will upload the bundle when that gets sorted out
Copy symlinks when creating android cipd package, and update to packa…
Copy symlinks when creating android cipd package, and update to packa…
github-actions commentedon Nov 13, 2025
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.Copy symlinks when creating android cipd package, and update to packa…
Copy symlinks when creating android cipd package, and update to packa…