Repository navigation
package assets declared under dev_dependency shouldn't be included in release bundle #79261
Copy link
Copy link
Closed
Labels
P3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projecta: assetsPackaging, accessing, or using assetsPackaging, accessing, or using assetsa: buildBuilding flutter applications with the toolBuilding flutter applications with the toola: releaseChallenges faced when attempting to productionize an appChallenges faced when attempting to productionize an appa: sizeReducing IPA/APK/JS sizesReducing IPA/APK/JS sizesc: proposalA detailed proposal for a change to FlutterA detailed proposal for a change to Flutterteam-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.triaged-toolTriaged by Flutter Tool teamTriaged by Flutter Tool team
Description
Steps to Reproduce
See example project https://github.com/rh-id/example_dev_dependency_fi for the steps
Expected results: Flutter should ignore package assets declared under dev_dependency on release bundle / version
Actual results: Flutter include the package assets declared under dev_dependency on release bundle / version
Logs
[✓] Flutter (Channel stable, 2.0.2, on Linux, locale en_US.UTF-8)
• Flutter version 2.0.2 at /home/rubyh/Flutter/flutter
• Framework revision 8962f6dc68 (3 weeks ago), 2021-03-11 13:22:20 -0800
• Engine revision 5d8bf811b3
• Dart version 2.12.1
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at /home/rubyh/Android/Sdk
• Platform android-30, build-tools 30.0.3
• ANDROID_HOME = /home/rubyh/Android/Sdk
• ANDROID_SDK_ROOT = /home/rubyh/Android/Sdk
• Java binary at: /usr/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.10+9-Ubuntu-0ubuntu1.20.04)
• All Android licenses accepted.
Related Issues:
Do not create plugins from dev_dependencies #56591
Don't include dev_dependencies in native build scripts #45714
integration_test embedded in shipping iOS apps when added to pubspec #74274
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projecta: assetsPackaging, accessing, or using assetsPackaging, accessing, or using assetsa: buildBuilding flutter applications with the toolBuilding flutter applications with the toola: releaseChallenges faced when attempting to productionize an appChallenges faced when attempting to productionize an appa: sizeReducing IPA/APK/JS sizesReducing IPA/APK/JS sizesc: proposalA detailed proposal for a change to FlutterA detailed proposal for a change to Flutterteam-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.triaged-toolTriaged by Flutter Tool teamTriaged by Flutter Tool team
Activity
pedromassangocode commentedon Mar 29, 2021
After reading this StackOverflow and https://dart.dev/tools/pub/dependencies#dev-dependencies I'm considering this as proposal as there is not documentation saying that assets from dev dependencies will not be included into the final app bundle.
If you have any reference about that please share the link.
Thank you
rh-id commentedon Mar 29, 2021
Hi, @pedromassangocode I'm not sure why it is a proposal not a bug, if the reason to label this as proposal was documentation,
so far I didn't find any flutter documentation saying anything on how
dev_dependenciesbehave with final app bundle as well. by that reasoningdev_dependenciesshouldn't work with flutter at all.If flutter follows dart documentation on
dev_dependencieswhich means ignoring the package on the final app bundle, then flutter should ignore the assets declared as well.rh-id commentedon Apr 6, 2021
hi @pedromassangocode Additional findings:
When adding
integration_testpackage todev_dependencies,GeneratedPluginRegistrantclass generate the integration test class as well.pubspec.yamlafter checking
classes.dexin my release bundle, theIntegrationTestPluginis included, so basically everything underdev_dependenciesis included in the release bundle? I'm not sure how to check if the dart code is included in the release bundle. since there is no documentation mentioning this does it mean it is as per existing behavior? so including integration test in the final release bundle is normal ?1 remaining item
blackmenthor commentedon Apr 19, 2023
Up for this issue (sorry for not just reacting), but one use-case that might be quite annoying is: say you have an assets that are only meant to be shipped during development and you don't want that to be included in the release bundle, it won't be possible until some exclusion of assets for production build is done.
Right now there's couple of solution that might work (e.g. using script that deletes some dependency or assets during
flutter build, but I'd have to admit that's not pretty.like-clockwork commentedon Aug 20, 2023
I'm here because I just discovered that in one of my projects I've been placing essential package references under 'dev_dependencies' this whole time - and yet, my release builds have been running flawlessly. I figure it might have something to do with this
chandrabezzo commentedon Sep 13, 2023
Just curious is there a plugin/package on dev_dependencies that contains large enough assets? Because I have never found a plugin/package that has very large assets on dev_dependencies 🤔
MeandNi commentedon Apr 15, 2024
Sometimes we want to use certain resources only under debug.
rh-id commentedon Apr 28, 2024
Hi all, adding related issues above. It seemed to occur on other platforms
zhujiageng commentedon Oct 28, 2024
any update?
taltap-jake commentedon Dec 19, 2024
We were affected by this issue today. The inclusion of
integration_testindev_dependenciescaused a crash in our release build. Very unintuitive, asdev_dependencieswas far from the first place we went looking for the cause of a crash in the release build.As it seems this is actually the way flutter behaves - we basically have no option but to inject the integration test dependencies into the pubspec.yaml as part of the runner script launching the tests. Not optimal.
Only bundle assets and plugins from transitive closure of dependencies (
github-actions commentedon Jun 2, 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.Only bundle assets and plugins from transitive closure of dependencie…