10000 Appbundle size increase of 90mb with flutter 3.7.0 without any change · Issue #119507 · flutter/flutter · GitHub
[go: up one dir, main page]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Appbundle size increase of 90mb with flutter 3.7.0 without any change #119507

Closed
enricoi opened this issue Jan 30, 2023 · 10 comments · Fixed by #120167
Closed

Appbundle size increase of 90mb with flutter 3.7.0 without any change #119507

enricoi opened this issue Jan 30, 2023 · 10 comments · Fixed by #120167
Assignees
Labels
a: build Building flutter applications with the tool c: regression It was better in the past than it is now found in release: 3.7 Found to occur in 3.7 P1 High-priority issues at the top of the work list perf: app size Performance issues related to app size (binary/code size) or disk space platform-android Android applications specifically r: fixed Issue is closed as already fixed in a newer version tool Affects the "flutter" command-line tool. See also t: labels.

Comments

@enricoi
Copy link
enricoi commented Jan 30, 2023

Same app, same files, same configuration. Only change is the upgrade flutter version from 3.3.10 to 3.7.0.

Build with 3.7.0:
✓ Built build/app/outputs/bundle/release/app-release.aab (351.1MB).

Build with 3.3.10
✓ Built build/app/outputs/bundle/release/app-release.aab (260.7MB).

With 3.7.0 is impossible to upload appbundle on play store due to 150mb size limit reached, with 3.3.10 upload complete successfully.

@enricoi enricoi added the from: performance template Issues created via a performance issue template label Jan 30, 2023
@darshankawar darshankawar removed the from: performance template Issues created via a performance issue template label Jan 30, 2023
@exaby73 exaby73 added the in triage Presently being triaged by the triage team label Jan 30, 2023
@exaby73
Copy link
Member
exaby73 commented Jan 30, 2023

Triage report

I can reproduce this issue. Here's what I found:

  • app-release.aab is 16.5 MB on 3.3.10
  • app-release.aab is 16.8 MB on 3.7.0, on a newly generate project as well as on the project generated with 3.3.10

I haven't tested it on a large project like OP has but this ~300 KB increase could scale up to a large amount with larger applications.

flutter doctor -v (Master)
[!] Flutter (Channel master, 3.7.0-29.0.pre.26, on macOS 13.1 22C65 darwin-arm64, locale en-US)
    • Flutter version 3.7.0-29.0.pre.26 on channel master at /Users/nabeelparkar/fvm/versions/master
    ! Warning: `dart` on your path resolves to /opt/homebrew/Cellar/dart/2.18.6/libexec/bin/dart, which is not inside your current Flutter SDK checkout at /Users/nabeelparkar/fvm/versions/master. Consider adding /Users/nabeelparkar/fvm/versions/master/bin to the front of your path.
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 15cd00f1ed (3 hours ago), 2023-01-29 21:58:05 -0500
    • Engine revision a7bb0e4108
    • Dart version 3.0.0 (build 3.0.0-179.0.dev)
    • DevTools version 2.20.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 33.0.0)
    • Android SDK at /Users/nabeelparkar/Library/Android/sdk/
    • Platform android-33, build-tools 33.0.0
    • ANDROID_SDK_ROOT = /Users/nabeelparkar/Library/Android/sdk/
    • Java binary at: /Users/nabeelparkar/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/213.7172.25.2113.9123335/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14C18
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • CHROME_EXECUTABLE = /Applications/Brave Browser.app/Contents/MacOS/Brave Browser

[✓] Android Studio (version 2021.3)
    • Android Studio at /Users/nabeelparkar/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/213.7172.25.2113.9123335/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)

[!] Android Studio (version 2022.1)
    • Android Studio at /Users/nabeelparkar/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/221.6008.13.2211.9477386/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    ✗ Unable to find bundled Java version.
    • Try updating or re-installing Android Studio.

[✓] VS Code (version 1.74.3)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.58.0

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-arm64   • macOS 13.1 22C65 darwin-arm64
    • Chrome (web)    • chrome • web-javascript • Brave Browser 109.1.47.186

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 2 categories.

@exaby73 exaby73 added tool Affects the "flutter" command-line tool. See also t: labels. c: performance Relates to speed or footprint issues (see "perf:" labels) a: build Building flutter applications with the tool perf: app size Performance issues related to app size (binary/code size) or disk space has reproducible steps The issue has been confirmed reproducible and is ready to work on found in release: 3.7 Found to occur in 3.7 platform-android Android applications specifically and removed in triage Presently being triaged by the triage team labels Jan 30, 2023
@jonahwilliams
Copy link
Member

An app bundle size on disk is not representitive of the final sized shipped to an end user application

@exaby73
Copy link
Member
exaby73 commented Jan 31, 2023

@jonahwilliams Are you saying that this is an invalid issue?

@enricoi
Copy link
Author
enricoi commented Jan 31, 2023

Upon further investigation I find the difference is that up until 3.3.10 files that are in the assets folders but not in the assets list in the pubspec.yaml are not counted within the .aab build. Since 3.7.0 folders that are not in the resource list in pubspec.yaml are still counted and contribute to the final aab build weight

Is it a wanted behavior? I found it convenient to manage different configurations (i.e. ios/android) the fact of being able to exclude folders by simply omitting them from the assets list in pubspec.yaml

@christopherfujino
Copy link
Member

assigning to @andrewkolos to investigate and prioritize

@andrewkolos
Copy link
Contributor
andrewkolos commented Feb 2, 2023

I was unable to reproduce this. Here is what I tried:

  1. Download this flutter project, which includes four large image files in an assets folder, with only two of them listed in assets in pubspec.yaml.
  2. From the flutter directory, git checkout 135454a (v3.3.10)
  3. From the project directory flutter clean && flutter build apk --split-per-abi
  4. Use a tool such as unzip or 7zip to decompress/examine the contents of build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk.
  5. Repeat 2-4 but using v3.7.1 (commit hash 7048ed9)

Here are the results I got:

Flutter 3.3.10: 20.4 MB uncompressed
Flutter 3.7.1: 20.5 MB uncompressed

The small (in this context) 0.1 MB difference appears to be mostly if not entirely from the flutter library lib/armeabi-v7a/libflutter.so.

A minimal, reproducable example of this issue would be appreciated.

@andrewkolos andrewkolos added waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds and removed has reproducible steps The issue has been confirmed reproducible and is ready to work on labels Feb 2, 2023
@enricoi
Copy link
Author
enricoi commented Feb 2, 2023

Hi @andrewkolos,
The problem occurs if you use subfolders.

Steps to reproduce:

  1. create a subfolder images in asset folder and put 2 images inside it (I put grass.jpg and pine.jpg)

  2. build appbundle with flutter 3.7.1 and this assets configuration in pubspec.yaml

  assets:
      - assets/
      - assets/images/

I get ✓ Built build/app/outputs/bundle/release/app-release.aab (33.9MB).

  1. build appbundle with flutter 3.7.1 and this assets configuration in pubspec.yaml without images folder
  assets:
      - assets/
    # - assets/images/

I get ✓ Built build/app/outputs/bundle/release/app-release.aab (33.9MB).

  1. Downgrade flutter to version 3.3.10

  2. build appbundle with flutter 3.3.10 and this asset configuration in pubspec.yaml

  assets:
      - assets/
      - assets/images/

I get ✓ Built build/app/outputs/bundle/release/app-release.aab (33.6MB).

  1. build appbundle with flutter 3.3.10 and this assets configuration in pubspec.yaml without images folder
  assets:
      - assets/
    # - assets/images/

I get ✓ Built build/app/outputs/bundle/release/app-release.aab (23.3MB).

As you could see app bundle count subfolders in a different way in the two flutter versions.

@github-actions github-actions bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Feb 2, 2023
@reidbaker reidbaker added P2 Important issues not at the top of the work list c: regression It was better in the past than it is now and removed c: performance Relates to speed or footprint issues (see "perf:" labels) labels Feb 2, 2023
@reidbaker
Copy link
Contributor

Thank you for this report. Based on your last comment the work around is to not use subfolders but I can see how this is a painful regression. Added to our list of issues to consider when we have availability.

@andrewkolos
Copy link
Contributor

@enricoi, thank you for the detailed repro steps👍. I was able to repro this time around, and I updated the example project I used to repro. I'll start investigating now.

@andrewkolos andrewkolos added P1 High-priority issues at the top of the work list and removed P2 Important issues not at the top of the work list labels Feb 2, 2023
@github-actions
Copy link
github-actions bot commented Mar 3, 2023

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a: build Building flutter applications with the tool c: regression It was better in the past than it is now found in release: 3.7 Found to occur in 3.7 P1 High-priority issues at the top of the work list perf: app size Performance issues related to app size (binary/code size) or disk space platform-android Android applications specifically r: fixed Issue is closed as already fixed in a newer version tool Affects the "flutter" command-line tool. See also t: labels.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants
0