Skip to content

Tree shaking of icons breaks display of variable icons with fill #183381

@PiotrRogulski

Description

@PiotrRogulski

Steps to reproduce

  1. Use a variable icon font with a fill axis (e.g., Material Symbols)
  2. Build the app with tree shaking enabled
  3. Switch between filled and unfilled states of icons

Expected results

Icons are rendered correctly for any fill value, even with tree shaking enabled.

Actual results

Some icons sometimes don't render (it seems random, which icons work and for which cases). Some icons render only for fill == 1, some render only for fill != 1. I observed this behavior on Android (emulator & physical device) and macOS.

Code sample

The reproduction app is at https://github.com/PiotrRogulski/icons_tree_shaking_issue (used for the recordings)

Screenshots or Video

Screenshots / Video demonstration

Correct behavior (tree shaking disabled)

flutter build apk --no-tree-shake-icons
icons_no_tree_shaking.mov

Incorrect behavior (tree shaking enabled)

flutter build apk
icons_with_tree_shaking.mov

Logs

Logs (logcat on an Android emulator)
2026-03-08 22:50:00.464  7928-7928  ApplicationLoaders      com...mple.icons_tree_shaking_issue  D  Returning zygote-cached class loader: /system_ext/framework/androidx.window.extensions.jar
2026-03-08 22:50:00.464  7928-7928  ApplicationLoaders      com...mple.icons_tree_shaking_issue  D  Returning zygote-cached class loader: /system_ext/framework/androidx.window.sidecar.jar
2026-03-08 22:50:00.465  7928-7928  nativeloader            com...mple.icons_tree_shaking_issue  D  Configuring clns-9 for other apk /data/app/~~kTwbz9JG6XNYhn84XrDiLA==/com.example.icons_tree_shaking_issue-KCVLFW5AHwI2W46DpoY4Bw==/base.apk. target_sdk_version=36, uses_libraries=, library_path=/data/app/~~kTwbz9JG6XNYhn84XrDiLA==/com.example.icons_tree_shaking_issue-KCVLFW5AHwI2W46DpoY4Bw==/lib/arm64:/data/app/~~kTwbz9JG6XNYhn84XrDiLA==/com.example.icons_tree_shaking_issue-KCVLFW5AHwI2W46DpoY4Bw==/base.apk!/lib/arm64-v8a, permitted_path=/data:/mnt/expand:/data/user/0/com.example.icons_tree_shaking_issue
2026-03-08 22:50:00.472  7928-7928  GraphicsEnvironment     com...mple.icons_tree_shaking_issue  V  Currently set values for:
2026-03-08 22:50:00.472  7928-7928  GraphicsEnvironment     com...mple.icons_tree_shaking_issue  V    angle_gl_driver_selection_pkgs=[]
2026-03-08 22:50:00.472  7928-7928  GraphicsEnvironment     com...mple.icons_tree_shaking_issue  V    angle_gl_driver_selection_values=[]
2026-03-08 22:50:00.472  7928-7928  GraphicsEnvironment     com...mple.icons_tree_shaking_issue  V  com.example.icons_tree_shaking_issue is not listed in per-application setting
2026-03-08 22:50:00.472  7928-7928  GraphicsEnvironment     com...mple.icons_tree_shaking_issue  V  No special selections for ANGLE, returning default driver choice
2026-03-08 22:50:00.473  7928-7928  GraphicsEnvironment     com...mple.icons_tree_shaking_issue  V  Neither updatable production driver nor prerelease driver is supported.
2026-03-08 22:50:00.477  7928-7941  DisplayManager          com...mple.icons_tree_shaking_issue  I  Choreographer implicitly registered for the refresh rate.
2026-03-08 22:50:00.483  7928-7945  nativeloader            com...mple.icons_tree_shaking_issue  D  Load /data/app/~~kTwbz9JG6XNYhn84XrDiLA==/com.example.icons_tree_shaking_issue-KCVLFW5AHwI2W46DpoY4Bw==/base.apk!/lib/arm64-v8a/libflutter.so using class loader ns clns-9 (caller=/data/app/~~kTwbz9JG6XNYhn84XrDiLA==/com.example.icons_tree_shaking_issue-KCVLFW5AHwI2W46DpoY4Bw==/base.apk): ok
2026-03-08 22:50:00.493  7928-7941  GFXSTREAM               com...mple.icons_tree_shaking_issue  I  [eglDisplay.cpp(297)] Opening libGLESv1_CM_emulation.so
2026-03-08 22:50:00.493  7928-7941  GFXSTREAM               com...mple.icons_tree_shaking_issue  I  [eglDisplay.cpp(297)] Opening libGLESv2_emulation.so
2026-03-08 22:50:00.491  7928-7928  e_shaking_issue         com...mple.icons_tree_shaking_issue  W  type=1400 audit(0.0:110): avc:  denied  { read } for  name="max_map_count" dev="proc" ino=29706 scontext=u:r:untrusted_app_34:s0:c242,c256,c512,c768 tcontext=u:object_r:proc_max_map_count:s0 tclass=file permissive=0 app=com.example.icons_tree_shaking_issue
2026-03-08 22:50:00.495  7928-7941  HWUI                    com...mple.icons_tree_shaking_issue  W  Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
2026-03-08 22:50:00.496  7928-7941  HWUI                    com...mple.icons_tree_shaking_issue  W  Failed to initialize 101010-2 format, error = EGL_SUCCESS
2026-03-08 22:50:00.500  7928-7928  DesktopExperienceFlags  com...mple.icons_tree_shaking_issue  D  Toggle override initialized to: false
2026-03-08 22:50:00.500  7928-7928  DesktopModeFlags        com...mple.icons_tree_shaking_issue  D  Toggle override initialized to: OVERRIDE_UNSET
2026-03-08 22:50:00.503  7928-7947  flutter                 com...mple.icons_tree_shaking_issue  I  [IMPORTANT:flutter/shell/platform/android/android_context_gl_impeller.cc(104)] Using the Impeller rendering backend (OpenGLES).
2026-03-08 22:50:00.506  7928-7928  CompatChangeReporter    com...mple.icons_tree_shaking_issue  D  Compat change id reported: 377864165; UID 10242; state: ENABLED
2026-03-08 22:50:00.507  7928-7928  HWUI                    com...mple.icons_tree_shaking_issue  W  Unknown dataspace 0
2026-03-08 22:50:00.518  7928-7928  WindowOnBackDispatcher  com...mple.icons_tree_shaking_issue  D  setTopOnBackInvokedCallback (unwrapped): android.app.Activity$$ExternalSyntheticLambda0@43ee38a
2026-03-08 22:50:00.519  7928-7928  WindowExtensionsImpl    com...mple.icons_tree_shaking_issue  I  Initializing Window Extensions, vendor API level=10, activity embedding enabled=true
2026-03-08 22:50:00.521  7928-7928  UiContextUtils          com...mple.icons_tree_shaking_issue  W  Requested context is a non-UI Context. Creating a UI-Context with display: 0. Context: Context=android.app.Application@f76ae9c, of which baseContext=android.app.ContextImpl@9d182de
2026-03-08 22:50:00.522  7928-7928  VRI[MainActivity]       com...mple.icons_tree_shaking_issue  D  WindowInsets changed: 1080x2424 statusBars:[0,152,0,0] navigationBars:[0,0,0,59] mandatorySystemGestures:[0,181,0,78] 
2026-03-08 22:50:00.836  7928-7928  WindowLayo...ponentImpl com...mple.icons_tree_shaking_issue  D  Register WindowLayoutInfoListener on Context=com.example.icons_tree_shaking_issue.MainActivity@dc50fb6, of which baseContext=android.app.ContextImpl@58a7142
2026-03-08 22:50:00.907  7928-7928  InsetsController        com...mple.icons_tree_shaking_issue  D  hide(ime())
2026-03-08 22:50:00.908  7928-7928  ImeTracker              com...mple.icons_tree_shaking_issue  I  com.example.icons_tree_shaking_issue:f4fe3290: onCancelled at PHASE_CLIENT_ALREADY_HIDDEN
2026-03-08 22:50:06.266  7928-7959  ProfileInstaller        com...mple.icons_tree_shaking_issue  D  Installing profile for com.example.icons_tree_shaking_issue

Flutter Doctor output

Doctor output
[✓] Flutter (Channel master, 3.42.0-1.0.pre-401, on macOS 26.4 25E5223i darwin-arm64, locale en-US) [2.1s]
    • Flutter version 3.42.0-1.0.pre-401 on channel master at /Users/piotr/fvm/versions/master
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision d9db05bf58 (3 days ago), 2026-03-05 11:46:56 -0500
    • Engine revision d9db05bf58
    • Dart version 3.12.0 (build 3.12.0-201.0.dev)
    • DevTools version 2.55.0
    • Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios, cli-animations, enable-native-assets, enable-dart-data-assets, enable-swift-package-manager, omit-legacy-version-file, enable-lldb-debugging, no-enable-uiscene-migration, enable-riscv64

[✓] Android toolchain - develop for Android devices (Android SDK version 36.1.0-rc1) [2.1s]
    • Android SDK at /Users/piotr/Library/Android/sdk
    • Emulator version 36.4.9.0 (build_id 14788078) (CL:N/A)
    • Platform android-36, build-tools 36.1.0-rc1
    • ANDROID_HOME = /Users/piotr/Library/Android/sdk
    • Java binary at: /Users/piotr/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.9+-14787801-b1163.94)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 26.2) [1,608ms]
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 17C52
    • CocoaPods version 1.16.2

[✓] Chrome - develop for the web [3ms]
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Connected device (3 available) [9.5s]
    • sdk gphone16k arm64 (mobile) • emulator-5554 • android-arm64  • Android 16 (API 36) (emulator)
    • macOS (desktop)              • macos         • darwin-arm64   • macOS 26.4 25E5223i darwin-arm64
    • Chrome (web)                 • chrome        • web-javascript • Google Chrome 145.0.7632.160

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

• No issues found!

Metadata

Metadata

Assignees

Labels

P1High-priority issues at the top of the work listplatform-androidAndroid applications specificallyteam-engineOwned by Engine teamtriaged-engineTriaged by Engine team

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions