Skip to content

support tree-shaking native assets when no used dart code references it #130811

Closed

Description

@makinghappen

Is there an existing issue for this?

Steps to reproduce

When building a project which includes a dependency having a native .so library linked via dart:ffi, it will be included in the resulting build even thou calls to that library were removed by tree-shaking dart code.

Expected results

libaudioplayers_linux_plugin.so library is not in the package

Actual results

libaudioplayers_linux_plugin.so library is in the package

Code sample

Code sample
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:audioplayers/audioplayers.dart';

import 'constants.dart';

class MyApp extends StatefulWidget {
  HomePage createState() => HomePage();
}

const enableAudioplayer = false;

class HomePage extends State<MyApp> {
  late var loop;

  @override
  void initState() {
    super.initState();
    // loop.ap.play(AssetSource("sound/happy_loop.mp3"));
    if (enableAudioplayer) {
      initAudioplayer();
    }
  }

  void initAudioplayer() {
    loop = AudioPlayer();
    // loop = Mgr();
    loop.setReleaseMode(ReleaseMode.loop);
    loop.play(AssetSource("sound/test.mp3"));
    loop.setVolume(0.5);
  }

  @override
  Widget build(BuildContext context) {
    return Stack();
  }
}


Screenshots or Video

No response

Logs

Logs
[ +544 ms] [6/10] Building CXX object plugins/audioplayers_linux/CMakeFiles/audioplayers_linux_plugin.dir/audio_player.cc.o
[ +309 ms] [7/10] Building CXX object plugins/audioplayers_linux/CMakeFiles/audioplayers_linux_plugin.dir/audioplayers_linux_plugin.cc.o
[ +134 ms] [8/10] Linking CXX shared library plugins/audioplayers_linux/libaudioplayers_linux_plugin.so
[ +196 ms] [9/10] Linking CXX executable intermediates_do_not_run/testapp
[        ] [9/10] Install the project...
[  +12 ms] -- Install configuration: "Release"
[   +8 ms] -- Installing: /home/make/testapp/build/linux/x64/release/bundle/testapp
[        ] -- Set runtime path of "/home/make/testapp/build/linux/x64/release/bundle/testapp" to "$ORIGIN/lib"
[        ] -- Installing: /home/make/testapp/build/linux/x64/release/bundle/data/icudtl.dat
[   +2 ms] -- Installing: /home/make/testapp/build/linux/x64/release/bundle/lib/libflutter_linux_gtk.so
[  +40 ms] -- Installing: /home/make/testapp/build/linux/x64/release/bundle/lib/libaudioplayers_linux_plugin.so

Flutter Doctor output

Doctor output
[✓] Flutter (Channel beta, 3.11.0-0.1.pre, on Debian GNU/Linux bookworm/sid 5.10.0-13-amd64, locale en_US.UTF-8)
    • Flutter version 3.11.0-0.1.pre on channel beta at /home/make/dev-tools/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 350d2c3a6c (8 weeks ago), 2023-05-23 15:52:05 -0700
    • Engine revision 7eca5cd1c5
    • Dart version 3.1.0 (build 3.1.0-63.1.beta)
    • DevTools version 2.23.1

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /home/make/AndroidSDK/
    • Platform android-33, build-tools 30.0.3
    • Java binary at: /snap/android-studio/125/android-studio/jre/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • Chrome at google-chrome

[✓] Linux toolchain - develop for Linux desktop
    • Debian clang version 14.0.6
    • cmake version 3.25.1
    • ninja version 1.11.1
    • pkg-config version 1.8.0

[✓] Android Studio (version 2021.3)
    • Android Studio at /snap/android-studio/125/android-studio
    • Flutter plugin version 72.1.1
    • Dart plugin version 213.7433
    • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)

[✓] Connected device (2 available)
    • Linux (desktop) • linux  • linux-x64      • Debian GNU/Linux bookworm/sid 5.10.0-13-amd64
    • Chrome (web)    • chrome • web-javascript • Chromium 108.0.5359.124 built on Debian bookworm/sid, running on Debian bookworm/sid

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

• No issues found!

Activity

  1. dcharkes commented on Jul 19, 2023

    @dcharkes
    Contributor
  2. added
    in triagePresently being triaged by the triage team
    on Jul 19, 2023
  3. huycozy commented on Jul 19, 2023

    @huycozy
    Member

    Thanks for the report. Following steps with url_launcher plugin and also seeing the issue.

    Complete sample code (url_launcher)
    import 'package:flutter/material.dart';
    import 'package:url_launcher/url_launcher.dart';
    
    final Uri _url = Uri.parse('https://flutter.dev');
    const enablePlugin = false;
    
    void main() => runApp(
          const MaterialApp(
            home: Material(
              child: Center(
                child: ElevatedButton(
                  onPressed: _launchUrl,
                  child: Text('Show Flutter homepage'),
                ),
              ),
            ),
          ),
        );
    
    Future<void> _launchUrl() async {
      if (enablePlugin) {
        if (!await launchUrl(_url)) {
          throw Exception('Could not launch $_url');
        }
      }
    }
    
    Output log build release (flutter build linux --release -v)
    huynq@ubuntu:~/Desktop/ffi_treeshaking_130811$ flutter build linux --release -v
    [   +2 ms] executing: [/home/huynq/Documents/Working/flutter/] git -c log.showSignature=false log -n 1
    --pretty=format:%H
    [  +12 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
    [        ] f468f3366c26a5092eb964a230ce7892fda8f2f8
    [        ] executing: [/home/huynq/Documents/Working/flutter/] git tag --points-at
    f468f3366c26a5092eb964a230ce7892fda8f2f8
    [  +15 ms] Exit code 0 from: git tag --points-at f468f3366c26a5092eb964a230ce7892fda8f2f8
    [        ] 3.10.6
    [   +1 ms] executing: [/home/huynq/Documents/Working/flutter/] git rev-parse --abbrev-ref HEAD
    [   +4 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
    [        ] stable
    [   +5 ms] executing: [/home/huynq/Documents/Working/flutter/] git rev-parse --abbrev-ref --symbolic @{upstream}
    [   +3 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{upstream}
    [        ] origin/stable
    [        ] executing: [/home/huynq/Documents/Working/flutter/] git ls-remote --get-url origin
    [   +3 ms] Exit code 0 from: git ls-remote --get-url origin
    [        ] https://github.com/flutter/flutter.git
    [        ] executing: uname -m
    [   +3 ms] Exit code 0 from: uname -m
    [        ] x86_64
    [  +33 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
    [        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
    [        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
    [        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
    [   +1 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
    [        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
    [        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
    [        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
    [        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
    [        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
    [        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
    [  +31 ms] Artifact Instance of 'MaterialFonts' is not required, skipping update.
    [        ] Artifact Instance of 'GradleWrapper' is not required, skipping update.
    [        ] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
    [        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
    [        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
    [        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
    [        ] Artifact Instance of 'FlutterSdk' is not required, skipping update.
    [        ] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
    [        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
    [   +1 ms] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
    [        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
    [        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
    [        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
    [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
    [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
    [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
    [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
    [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
    [        ] Artifact Instance of 'FontSubsetArtifacts' is not required, skipping update.
    [        ] Artifact Instance of 'PubDependencies' is not required, skipping update.
    [  +69 ms] Skipping pub get: version match.
    [  +36 ms] Found plugin url_launcher at /home/huynq/.pub-cache/hosted/pub.dev/url_launcher-6.1.12/
    [   +3 ms] Found plugin url_launcher_android at /home/huynq/.pub-cache/hosted/pub.dev/url_launcher_android-6.0.36/
    [   +2 ms] Found plugin url_launcher_ios at /home/huynq/.pub-cache/hosted/pub.dev/url_launcher_ios-6.1.4/
    [   +2 ms] Found plugin url_launcher_linux at /home/huynq/.pub-cache/hosted/pub.dev/url_launcher_linux-3.0.5/
    [   +2 ms] Found plugin url_launcher_macos at /home/huynq/.pub-cache/hosted/pub.dev/url_launcher_macos-3.0.6/
    [   +2 ms] Found plugin url_launcher_web at /home/huynq/.pub-cache/hosted/pub.dev/url_launcher_web-2.0.18/
    [   +1 ms] Found plugin url_launcher_windows at /home/huynq/.pub-cache/hosted/pub.dev/url_launcher_windows-3.0.7/
    [  +48 ms] Found plugin url_launcher at /home/huynq/.pub-cache/hosted/pub.dev/url_launcher-6.1.12/
    [   +1 ms] Found plugin url_launcher_android at /home/huynq/.pub-cache/hosted/pub.dev/url_launcher_android-6.0.36/
    [   +2 ms] Found plugin url_launcher_ios at /home/huynq/.pub-cache/hosted/pub.dev/url_launcher_ios-6.1.4/
    [   +1 ms] Found plugin url_launcher_linux at /home/huynq/.pub-cache/hosted/pub.dev/url_launcher_linux-3.0.5/
    [   +1 ms] Found plugin url_launcher_macos at /home/huynq/.pub-cache/hosted/pub.dev/url_launcher_macos-3.0.6/
    [   +2 ms] Found plugin url_launcher_web at /home/huynq/.pub-cache/hosted/pub.dev/url_launcher_web-2.0.18/
    [   +1 ms] Found plugin url_launcher_windows at /home/huynq/.pub-cache/hosted/pub.dev/url_launcher_windows-3.0.7/
    [  +37 ms] Found plugin url_launcher at /home/huynq/.pub-cache/hosted/pub.dev/url_launcher-6.1.12/
    [        ] Found plugin url_launcher_android at /home/huynq/.pub-cache/hosted/pub.dev/url_launcher_android-6.0.36/
    [        ] Found plugin url_launcher_ios at /home/huynq/.pub-cache/hosted/pub.dev/url_launcher_ios-6.1.4/
    [        ] Found plugin url_launcher_linux at /home/huynq/.pub-cache/hosted/pub.dev/url_launcher_linux-3.0.5/
    [        ] Found plugin url_launcher_macos at /home/huynq/.pub-cache/hosted/pub.dev/url_launcher_macos-3.0.6/
    [   +1 ms] Found plugin url_launcher_web at /home/huynq/.pub-cache/hosted/pub.dev/url_launcher_web-2.0.18/
    [        ] Found plugin url_launcher_windows at /home/huynq/.pub-cache/hosted/pub.dev/url_launcher_windows-3.0.7/
    [  +52 ms] Generating
    /home/huynq/Desktop/ffi_treeshaking_130811/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java
    [  +40 ms] Building Linux application...
    [   +9 ms] executing: [build/linux/x64/release/] cmake -G Ninja -DCMAKE_BUILD_TYPE=Release
    -DFLUTTER_TARGET_PLATFORM=linux-x64 /home/huynq/Desktop/ffi_treeshaking_130811/linux
    [ +108 ms] -- The CXX compiler identification is Clang 10.0.0
    [   +1 ms] -- Detecting CXX compiler ABI info
    [  +93 ms] -- Detecting CXX compiler ABI info - done
    [   +5 ms] -- Check for working CXX compiler: /usr/bin/clang++ - skipped
    [        ] -- Detecting CXX compile features
    [        ] -- Detecting CXX compile features - done
    [   +4 ms] -- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.2") 
    [        ] -- Checking for module 'gtk+-3.0'
    [  +11 ms] --   Found gtk+-3.0, version 3.24.33
    [  +55 ms] -- Checking for module 'glib-2.0'
    [   +8 ms] --   Found glib-2.0, version 2.72.4
    [  +21 ms] -- Checking for module 'gio-2.0'
    [   +8 ms] --   Found gio-2.0, version 2.72.4
    [  +30 ms] -- Configuring done
    [  +10 ms] -- Generating done
    [   +4 ms] -- Build files have been written to: /home/huynq/Desktop/ffi_treeshaking_130811/build/linux/x64/release
    [   +9 ms] executing: ninja -C build/linux/x64/release install
    [   +5 ms] ninja: Entering directory `build/linux/x64/release'
    [+17459 ms] [1/8] Generating
    /home/huynq/Desktop/ffi_treeshaking_130811/linux/flutter/ephemeral/libflutter_linux_gtk.so,
    /home/huynq/Desktop/ffi_treeshaking_130811/linux/flutter/ephemeral/flutter_linux/fl_basic_message_channel.h,
    /home/huynq/Desktop/ffi_treeshaking_130811/linux/flutter/ephemeral/flutter_linux/fl_binary_codec.h,
    /home/huynq/Desktop/ffi_treeshaking_130811/linux/flutter/ephemeral/flutter_linux/fl_binary_messenger.h,
    /home/huynq/Desktop/ffi_treeshaking_130811/linux/flutter/ephemeral/flutter_linux/fl_dart_project.h,
    /home/huynq/Desktop/ffi_treeshaking_130811/linux/flutter/ephemeral/flutter_linux/fl_engine.h,
    /home/huynq/Desktop/ffi_treeshaking_130811/linux/flutter/ephemeral/flutter_linux/fl_json_message_codec.h,
    /home/huynq/Desktop/ffi_treeshaking_130811/linux/flutter/ephemeral/flutter_linux/fl_json_method_codec.h,
    /home/huynq/Desktop/ffi_treeshaking_130811/linux/flutter/ephemeral/flutter_linux/fl_message_codec.h,
    /home/huynq/Desktop/ffi_treeshaking_130811/linux/flutter/ephemeral/flutter_linux/fl_method_call.h,
    /home/huynq/Desktop/ffi_treeshaking_130811/linux/flutter/ephemeral/flutter_linux/fl_method_channel.h,
    /home/huynq/Desktop/ffi_treeshaking_130811/linux/flutter/ephemeral/flutter_linux/fl_method_codec.h,
    /home/huynq/Desktop/ffi_treeshaking_130811/linux/flutter/ephemeral/flutter_linux/fl_method_response.h,
    /home/huynq/Desktop/ffi_treeshaking_130811/linux/flutter/ephemeral/flutter_linux/fl_plugin_registrar.h,
    /home/huynq/Desktop/ffi_treeshaking_130811/linux/flutter/ephemeral/flutter_linux/fl_plugin_registry.h,
    /home/huynq/Desktop/ffi_treeshaking_130811/linux/flutter/ephemeral/flutter_linux/fl_standard_message_codec.h,
    /home/huynq/Desktop/ffi_treeshaking_130811/linux/flutter/ephemeral/flutter_linux/fl_standard_method_codec.h,
    /home/huynq/Desktop/ffi_treeshaking_130811/linux/flutter/ephemeral/flutter_linux/fl_string_codec.h,
    /home/huynq/Desktop/ffi_treeshaking_130811/linux/flutter/ephemeral/flutter_linux/fl_value.h,
    /home/huynq/Desktop/ffi_treeshaking_130811/linux/flutter/ephemeral/flutter_linux/fl_view.h,
    /home/huynq/Desktop/ffi_treeshaking_130811/linux/flutter/ephemeral/flutter_linux/flutter_linux.h, _phony_
    [   +9 ms] [   +1 ms] executing: [/home/huynq/Documents/Working/flutter/] git -c log.showSignature=false log -n 1
    --pretty=format:%H
    [   +1 ms] [  +10 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
    [        ] [        ] f468f3366c26a5092eb964a230ce7892fda8f2f8
    [        ] [        ] executing: [/home/huynq/Documents/Working/flutter/] git tag --points-at
    f468f3366c26a5092eb964a230ce7892fda8f2f8
    [   +1 ms] [  +15 ms] Exit code 0 from: git tag --points-at f468f3366c26a5092eb964a230ce7892fda8f2f8
    [        ] [        ] 3.10.6
    [        ] [   +1 ms] executing: [/home/huynq/Documents/Working/flutter/] git rev-parse --abbrev-ref HEAD
    [   +1 ms] [   +3 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
    [        ] [        ] stable
    [        ] [   +5 ms] executing: [/home/huynq/Documents/Working/flutter/] git rev-parse --abbrev-ref --symbolic
    @{upstream}
    [        ] [   +3 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{upstream}
    [        ] [        ] origin/stable
    [        ] [        ] executing: [/home/huynq/Documents/Working/flutter/] git ls-remote --get-url origin
    [        ] [   +3 ms] Exit code 0 from: git ls-remote --get-url origin
    [        ] [        ] https://github.com/flutter/flutter.git
    [        ] [        ] executing: uname -m
    [        ] [   +2 ms] Exit code 0 from: uname -m
    [        ] [        ] x86_64
    [   +1 ms] [  +21 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
    [        ] [        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
    [        ] [        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
    [        ] [        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
    [        ] [   +1 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
    [        ] [        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
    [        ] [        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
    [        ] [        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
    [        ] [        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
    [        ] [        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
    [        ] [        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
    [        ] [  +67 ms] Artifact Instance of 'MaterialFonts' is not required, skipping update.
    [        ] [        ] Artifact Instance of 'GradleWrapper' is not required, skipping update.
    [        ] [        ] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
    [        ] [        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
    [        ] [        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
    [        ] [        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
    [        ] [        ] Artifact Instance of 'FlutterSdk' is not required, skipping update.
    [        ] [        ] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
    [   +2 ms] [        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
    [        ] [        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
    [        ] [        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
    [        ] [        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
    [        ] [        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
    [        ] [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
    [        ] [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
    [        ] [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
    [        ] [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
    [        ] [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
    [   +4 ms] [        ] Artifact Instance of 'FontSubsetArtifacts' is not required, skipping update.
    [        ] [        ] Artifact Instance of 'PubDependencies' is not required, skipping update.
    [        ] [  +19 ms] Initializing file store
    [        ] [  +10 ms] Skipping target: gen_localizations
    [        ] [   +9 ms] gen_dart_plugin_registrant: Starting due to {InvalidatedReasonKind.inputChanged: The following
    inputs have updated contents: /home/huynq/Desktop/ffi_treeshaking_130811/.dart_tool/package_config_subset}
    [        ] [   +2 ms] unpack_linux: Starting due to {}
    [        ] [  +58 ms] unpack_linux: Complete
    [        ] [ +219 ms] Found plugin url_launcher at /home/huynq/.pub-cache/hosted/pub.dev/url_launcher-6.1.12/
    [        ] [   +4 ms] Found plugin url_launcher_android at
    /home/huynq/.pub-cache/hosted/pub.dev/url_launcher_android-6.0.36/
    [        ] [   +1 ms] Found plugin url_launcher_ios at /home/huynq/.pub-cache/hosted/pub.dev/url_launcher_ios-6.1.4/
    [        ] [   +1 ms] Found plugin url_launcher_linux at
    /home/huynq/.pub-cache/hosted/pub.dev/url_launcher_linux-3.0.5/
    [        ] [   +1 ms] Found plugin url_launcher_macos at
    /home/huynq/.pub-cache/hosted/pub.dev/url_launcher_macos-3.0.6/
    [        ] [   +2 ms] Found plugin url_launcher_web at /home/huynq/.pub-cache/hosted/pub.dev/url_launcher_web-2.0.18/
    [        ] [   +1 ms] Found plugin url_launcher_windows at
    /home/huynq/.pub-cache/hosted/pub.dev/url_launcher_windows-3.0.7/
    [        ] [  +24 ms] gen_dart_plugin_registrant: Complete
    [        ] [   +2 ms] kernel_snapshot: Starting due to {}
    [   +5 ms] [   +7 ms] /home/huynq/Documents/Working/flutter/bin/cache/dart-sdk/bin/dart --disable-dart-dev
    /home/huynq/Documents/Working/flutter/bin/cache/dart-sdk/bin/snapshots/frontend_server.dart.snapshot --sdk-root
    /home/huynq/Documents/Working/flutter/bin/cache/artifacts/engine/common/flutter_patched_sdk_product/ --target=flutter
    --no-print-incremental-dependencies -Ddart.vm.profile=false -Ddart.vm.product=true --aot --tfa --packages
    /home/huynq/Desktop/ffi_treeshaking_130811/.dart_tool/package_config.json --output-dill
    /home/huynq/Desktop/ffi_treeshaking_130811/.dart_tool/flutter_build/b30e4bd3483e8a42f00ca7a353e68efb/app.dill
    --depfile
    /home/huynq/Desktop/ffi_treeshaking_130811/.dart_tool/flutter_build/b30e4bd3483e8a42f00ca7a353e68efb/kernel_snapshot.d
    --source file:///home/huynq/Desktop/ffi_treeshaking_130811/.dart_tool/flutter_build/dart_plugin_registrant.dart
    --source package:flutter/src/dart_plugin_registrant.dart
    -Dflutter.dart_plugin_registrant=file:///home/huynq/Desktop/ffi_treeshaking_130811/.dart_tool/flutter_build/dart_plugi
    n_registrant.dart --verbosity=error package:ffi_treeshaking_130811/main.dart
    [   +1 ms] [+11664 ms] kernel_snapshot: Complete
    [   +7 ms] [ +294 ms] aot_elf_release: Starting due to {InvalidatedReasonKind.inputChanged: The following inputs have
    updated contents:
    /home/huynq/Documents/Working/flutter/packages/flutter_tools/lib/src/build_system/targets/common.dart,/home/huynq/Desk
    top/ffi_treeshaking_130811/.dart_tool/flutter_build/b30e4bd3483e8a42f00ca7a353e68efb/app.dill,/home/huynq/Documents/Wo
    rking/flutter/bin/internal/engine.version,/home/huynq/Documents/Working/flutter/bin/internal/engine.version,/home/huyn
    q/Documents/Working/flutter/bin/internal/engine.version}
    [        ] [   +2 ms] targetingApplePlatform = false
    [        ] [        ] extractAppleDebugSymbols = true
    [        ] [        ] Will strip AOT snapshot during build.
    [   +1 ms] [   +1 ms] executing:
    /home/huynq/Documents/Working/flutter/bin/cache/artifacts/engine/linux-x64-release/gen_snapshot --deterministic
    --snapshot_kind=app-aot-elf
    --elf=/home/huynq/Desktop/ffi_treeshaking_130811/.dart_tool/flutter_build/b30e4bd3483e8a42f00ca7a353e68efb/app.so
    --strip /home/huynq/Desktop/ffi_treeshaking_130811/.dart_tool/flutter_build/b30e4bd3483e8a42f00ca7a353e68efb/app.dill
    [        ] [+4239 ms] aot_elf_release: Complete
    [        ] [  +20 ms] linux_aot_bundle: Starting due to {InvalidatedReasonKind.inputChanged: The following inputs have
    updated contents:
    /home/huynq/Desktop/ffi_treeshaking_130811/.dart_tool/flutter_build/b30e4bd3483e8a42f00ca7a353e68efb/app.so}
    [        ] [   +3 ms] linux_aot_bundle: Complete
    [        ] [  +18 ms] release_bundle_linux-x64_assets: Starting due to {}
    [   +2 ms] [  +93 ms] shaderc command:
    [/home/huynq/Documents/Working/flutter/bin/cache/artifacts/engine/linux-x64/impellerc, --sksl, --iplr,
    --sl=/home/huynq/Desktop/ffi_treeshaking_130811/build/flutter_assets/shaders/ink_sparkle.frag,
    --spirv=/home/huynq/Desktop/ffi_treeshaking_130811/build/flutter_assets/shaders/ink_sparkle.frag.spirv,
    --input=/home/huynq/Documents/Working/flutter/packages/flutter/lib/src/material/shaders/ink_sparkle.frag,
    --input-type=frag, --include=/home/huynq/Documents/Working/flutter/packages/flutter/lib/src/material/shaders,
    --include=/home/huynq/Documents/Working/flutter/bin/cache/artifacts/engine/linux-x64/shader_lib]
    [   +2 ms] [ +201 ms] release_bundle_linux-x64_assets: Complete
    [        ] [  +35 ms] Persisting file store
    [        ] [   +5 ms] Done persisting file store
    [        ] [   +4 ms] build succeeded.
    [        ] [  +10 ms] "flutter assemble" took 17,034ms.
    [        ] [   +9 ms] Running 0 shutdown hooks
    [        ] [        ] Shutdown hooks complete
    [        ] [        ] exiting with code 0
    [ +382 ms] [2/8] Building CXX object CMakeFiles/ffi_treeshaking_130811.dir/main.cc.o
    [  +17 ms] [3/8] Building CXX object CMakeFiles/ffi_treeshaking_130811.dir/flutter/generated_plugin_registrant.cc.o
    [  +19 ms] [4/8] Building CXX object CMakeFiles/ffi_treeshaking_130811.dir/my_application.cc.o
    [  +33 ms] [5/8] Building CXX object
    plugins/url_launcher_linux/CMakeFiles/url_launcher_linux_plugin.dir/url_launcher_plugin.cc.o
    [  +89 ms] [6/8] Linking CXX shared library plugins/url_launcher_linux/liburl_launcher_linux_plugin.so
    [ +123 ms] [7/8] Linking CXX executable intermediates_do_not_run/ffi_treeshaking_130811
    [        ] [7/8] Install the project...
    [   +6 ms] -- Install configuration: "Release"
    [        ] -- Installing:
    /home/huynq/Desktop/ffi_treeshaking_130811/build/linux/x64/release/bundle/ffi_treeshaking_130811
    [        ] -- Set runtime path of
    "/home/huynq/Desktop/ffi_treeshaking_130811/build/linux/x64/release/bundle/ffi_treeshaking_130811" to "$ORIGIN/lib"
    [        ] -- Installing: /home/huynq/Desktop/ffi_treeshaking_130811/build/linux/x64/release/bundle/data/icudtl.dat
    [        ] -- Installing:
    /home/huynq/Desktop/ffi_treeshaking_130811/build/linux/x64/release/bundle/lib/libflutter_linux_gtk.so
    [  +17 ms] -- Installing:
    /home/huynq/Desktop/ffi_treeshaking_130811/build/linux/x64/release/bundle/lib/liburl_launcher_linux_plugin.so
    [        ] -- Installing:
    /home/huynq/Desktop/ffi_treeshaking_130811/build/linux/x64/release/bundle/data/flutter_assets
    [        ] -- Installing:
    /home/huynq/Desktop/ffi_treeshaking_130811/build/linux/x64/release/bundle/data/flutter_assets/shaders
    [        ] -- Installing:
    /home/huynq/Desktop/ffi_treeshaking_130811/build/linux/x64/release/bundle/data/flutter_assets/shaders/ink_sparkle.frag
    [        ] -- Installing:
    /home/huynq/Desktop/ffi_treeshaking_130811/build/linux/x64/release/bundle/data/flutter_assets/fonts
    [        ] -- Installing:
    /home/huynq/Desktop/ffi_treeshaking_130811/build/linux/x64/release/bundle/data/flutter_assets/fonts/MaterialIcons-Regu
    lar.otf
    [   +1 ms] -- Installing:
    /home/huynq/Desktop/ffi_treeshaking_130811/build/linux/x64/release/bundle/data/flutter_assets/AssetManifest.json
    [        ] -- Installing:
    /home/huynq/Desktop/ffi_treeshaking_130811/build/linux/x64/release/bundle/data/flutter_assets/NOTICES.Z
    [        ] -- Installing:
    /home/huynq/Desktop/ffi_treeshaking_130811/build/linux/x64/release/bundle/data/flutter_assets/FontManifest.json
    [        ] -- Installing:
    /home/huynq/Desktop/ffi_treeshaking_130811/build/linux/x64/release/bundle/data/flutter_assets/packages
    [        ] -- Installing:
    /home/huynq/Desktop/ffi_treeshaking_130811/build/linux/x64/release/bundle/data/flutter_assets/packages/cupertino_icons
    [        ] -- Installing:
    /home/huynq/Desktop/ffi_treeshaking_130811/build/linux/x64/release/bundle/data/flutter_assets/packages/cupertino_icons
    /assets
    [        ] -- Installing:
    /home/huynq/Desktop/ffi_treeshaking_130811/build/linux/x64/release/bundle/data/flutter_assets/packages/cupertino_icons
    /assets/CupertinoIcons.ttf
    [        ] -- Installing:
    /home/huynq/Desktop/ffi_treeshaking_130811/build/linux/x64/release/bundle/data/flutter_assets/AssetManifest.bin
    [        ] -- Installing:
    /home/huynq/Desktop/ffi_treeshaking_130811/build/linux/x64/release/bundle/data/flutter_assets/version.json
    [        ] -- Installing: /home/huynq/Desktop/ffi_treeshaking_130811/build/linux/x64/release/bundle/lib/libapp.so
    [  +11 ms] Building Linux application... (completed in 18.6s)
    [        ] "flutter linux" took 18,990ms.
    [   +4 ms] Running 0 shutdown hooks
    [        ] Shutdown hooks complete
    [        ] exiting with code 0
    flutter doctor -v (stable & master)
    [!] Flutter (Channel stable, 3.10.6, on Ubuntu 22.04.1 LTS 5.19.0-46-generic, locale en_US.UTF-8)
        • Flutter version 3.10.6 on channel stable at /home/huynq/Documents/Working/flutter
        ! Warning: `dart` on your path resolves to /usr/lib/dart/bin/dart, which is not inside your current Flutter SDK
          checkout at /home/huynq/Documents/Working/flutter. Consider adding /home/huynq/Documents/Working/flutter/bin to the
          front of your path.
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision f468f3366c (6 days ago), 2023-07-12 15:19:05 -0700
        • Engine revision cdbeda788a
        • Dart version 3.0.6
        • DevTools version 2.23.1
        • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to
          perform update checks and upgrades.
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0-rc3)
        • Android SDK at /home/huynq/Android/Sdk/
        • Platform android-31, build-tools 34.0.0-rc3
        • Java binary at: /home/huynq/Documents/android-studio/jre/bin/java
        • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)
        • All Android licenses accepted.
    
    [✓] Chrome - develop for the web
        • Chrome at google-chrome
    
    [✓] Linux toolchain - develop for Linux desktop
        • clang version 10.0.0-4ubuntu1
        • cmake version 3.22.1
        • ninja version 1.10.1
        • pkg-config version 0.29.2
    
    [✓] Android Studio (version 2021.1)
        • Android Studio at /home/huynq/Documents/android-studio
        • Flutter plugin version 67.0.1
        • Dart plugin version 211.7817
        • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)
    
    [✓] VS Code (version 1.78.0)
        • VS Code at /usr/share/code
        • Flutter extension version 3.68.0
    
    [✓] Connected device (2 available)
        • Linux (desktop) • linux  • linux-x64      • Ubuntu 22.04.1 LTS 5.19.0-46-generic
        • Chrome (web)    • chrome • web-javascript • Google Chrome 112.0.5615.121
    
    [✓] Network resources
        • All expected network resources are available.
    
    ! Doctor found issues in 1 category.
    [!] Flutter (Channel master, 3.13.0-6.0.pre.32, on Ubuntu 22.04.1 LTS 5.19.0-46-generic, locale en_US.UTF-8)
        • Flutter version 3.13.0-6.0.pre.32 on channel master at /home/huynq/Documents/Working/flutter_master
        ! Warning: `flutter` on your path resolves to /home/huynq/Documents/Working/flutter/bin/flutter, which is not inside
          your current Flutter SDK checkout at /home/huynq/Documents/Working/flutter_master. Consider adding
          /home/huynq/Documents/Working/flutter_master/bin to the front of your path.
        ! Warning: `dart` on your path resolves to /usr/lib/dart/bin/dart, which is not inside your current Flutter SDK
          checkout at /home/huynq/Documents/Working/flutter_master. Consider adding
          /home/huynq/Documents/Working/flutter_master/bin to the front of your path.
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision 3213588c03 (62 minutes ago), 2023-07-19 03:20:21 -0400
        • Engine revision 0293a7cb78
        • Dart version 3.1.0 (build 3.1.0-325.0.dev)
        • DevTools version 2.25.0
        • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to
          perform update checks and upgrades.
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0-rc3)
        • Android SDK at /home/huynq/Android/Sdk/
        • Platform android-31, build-tools 34.0.0-rc3
        • Java binary at: /home/huynq/Documents/android-studio/jre/bin/java
        • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)
        • All Android licenses accepted.
    
    [✓] Chrome - develop for the web
        • Chrome at google-chrome
    
    [✓] Linux toolchain - develop for Linux desktop
        • clang version 10.0.0-4ubuntu1
        • cmake version 3.22.1
        • ninja version 1.10.1
        • pkg-config version 0.29.2
    
    [✓] Android Studio (version 2021.1)
        • Android Studio at /home/huynq/Documents/android-studio
        • Flutter plugin version 67.0.1
        • Dart plugin version 211.7817
        • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)
    
    [✓] VS Code (version 1.78.0)
        • VS Code at /usr/share/code
        • Flutter extension version 3.68.0
    
    [✓] Connected device (2 available)
        • Linux (desktop) • linux  • linux-x64      • Ubuntu 22.04.1 LTS 5.19.0-46-generic
        • Chrome (web)    • chrome • web-javascript • Google Chrome 112.0.5615.121
    
    [✓] Network resources
        • All expected network resources are available.
    
    ! Doctor found issues in 1 category.
  4. added
    toolAffects the "flutter" command-line tool. See also t: labels.
    a: buildBuilding flutter applications with the tool
    has reproducible stepsThe issue has been confirmed reproducible and is ready to work on
    team-toolOwned by Flutter Tool team
    and removed
    in triagePresently being triaged by the triage team
    on Jul 19, 2023
  5. changed the title [-]native library is included into the package when tree-shaking has removed relevant dart code[/-] [+]support tree-shaking native assets when no used dart code references it[/+] on Jul 25, 2023
  6. added
    P2Important issues not at the top of the work list
    triaged-toolTriaged by Flutter Tool team
    on Jul 25, 2023
  7. a-siva commented on Feb 8, 2024

    @a-siva
    Contributor

    @dcharkes is this on your radar to address ?

  8. dcharkes commented on Feb 8, 2024

    @dcharkes
    Contributor
  9. added
    tool-still-validIssues that have been deemed still valid as part of the Flutter Tools issue cleanup initiative.
    on Jul 11, 2025
  10. added a commit that references this issue on Aug 27, 2026
    9b04ad5
  11. github-actions commented on Sep 10, 2026

    @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.

  12. locked as resolved and limited conversation to collaborators on Sep 10, 2026
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 tooldependency: dartDart team may need to help usdependency:dart-triagedTriaged by Dart teamfound in release: 3.10Found to occur in 3.10found in release: 3.13Found to occur in 3.13has reproducible stepsThe issue has been confirmed reproducible and is ready to work onteam-toolOwned by Flutter Tool teamtoolAffects the "flutter" command-line tool. See also t: labels.tool-still-validIssues that have been deemed still valid as part of the Flutter Tools issue cleanup initiative.triaged-toolTriaged by Flutter Tool team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions