Repository navigation
Closed
Closed
Copy link
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: buildBuilding flutter applications with the toolBuilding flutter applications with the tooldependency: dartDart team may need to help usDart team may need to help usdependency:dart-triagedTriaged by Dart teamTriaged by Dart teamfound in release: 3.10Found to occur in 3.10Found to occur in 3.10found in release: 3.13Found to occur in 3.13Found to occur in 3.13has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onteam-toolOwned by Flutter Tool teamOwned by Flutter Tool teamtoolAffects the "flutter" command-line tool. See also t: labels.Affects 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.Issues that have been deemed still valid as part of the Flutter Tools issue cleanup initiative.triaged-toolTriaged by Flutter Tool teamTriaged by Flutter Tool team
Description
Is there an existing issue for this?
- I have searched the existing issues
- I have read the guide to filing a bug
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.soFlutter 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!Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: buildBuilding flutter applications with the toolBuilding flutter applications with the tooldependency: dartDart team may need to help usDart team may need to help usdependency:dart-triagedTriaged by Dart teamTriaged by Dart teamfound in release: 3.10Found to occur in 3.10Found to occur in 3.10found in release: 3.13Found to occur in 3.13Found to occur in 3.13has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onteam-toolOwned by Flutter Tool teamOwned by Flutter Tool teamtoolAffects the "flutter" command-line tool. See also t: labels.Affects 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.Issues that have been deemed still valid as part of the Flutter Tools issue cleanup initiative.triaged-toolTriaged by Flutter Tool teamTriaged by Flutter Tool team
Activity
dcharkes commentedon Jul 19, 2023
See my reply in:
We first need to address:
huycozy commentedon Jul 19, 2023
Thanks for the report. Following steps with
url_launcherplugin and also seeing the issue.Complete sample code (url_launcher)
Output log build release (flutter build linux --release -v)
flutter doctor -v (stable & master)
[-]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[/+]a-siva commentedon Feb 8, 2024
@dcharkes is this on your radar to address ?
dcharkes commentedon Feb 8, 2024
Yep, here's the Dart issue tracking this:
[flutter_tools] Verify native assets tree-shaking during linking (flu…
github-actions commentedon Sep 10, 2026
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.