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

[Android][iOS] Builds generated on different machines have different sizes #137990

Open
2 tasks done
Tracked by #130635
StarRookies opened this issue Nov 7, 2023 · 12 comments
Open
2 tasks done
Tracked by #130635
Labels
a: build Building flutter applications with the tool a: size Reducing IPA/APK/JS sizes P3 Issues that are less important to the Flutter project platform-android Android applications specifically platform-ios iOS applications specifically team-tool Owned by Flutter Tool team tool Affects the "flutter" command-line tool. See also t: labels. triaged-tool Triaged by Flutter Tool team

Comments

@StarRookies
Copy link

StarRookies commented Nov 7, 2023

Is there an existing issue for this?

Use case

APK Size

Proposal

Subject:On different machines, the same App is packaged to generate Android xxx.apk or iOS xxx.ipa packages of different sizes.

Dear Google Flutter Team,

I hope this message finds you well. I am writing to ask whether this question is a normal phenomenon.

As you know, there are many factors that affect package size when packaging Flutter programs. For example: Flutter core engine, framework, application code, license file size, necessary Java code, Flutter and Dart versions, packaged platform, etc.

According to the above conceivable conditions, we have conducted a large number of tests to ensure that the versions of Flutter and Dart are the same, and the source code of the packaged App needs to be consistent (the signatures are all used by default, without special treatment).

When packaged on different Windows computers (with the same operating system), the test results show that the size of the .apk or .ipa packaged each time is completely different.

Packaging on different Windows computers (the operating system is the same), even if the size of the apk is the same, but the value of sha1 is different.

Here are some of the intercepted packaging records:

OS Flutter Dart Packaged Size Other
windows 3.7.5 2.19.2 25,647,494 sha1: b05453d8e3212fc92cf9641c95beae7a5d7c9535
windows 3.7.5 2.19.2 25,647,494 sha1: 39520075ac2f16bbc0a953b5f0b5561925907e7f
windows 3.7.5 2.19.2 25,649,671 -
windows 3.7.5 2.19.2 25,647,522 -

The above tests are all packaged to generate the apk package of Android.

From the above results, we can see that all the factors that can be controlled on my side are under control, and we can see that the size of the package generated is different.

Note that SHA1 values are also different, whether it can be assumed that even if the files packaged by the same computer are of the same size, the actual package contents will be different.

So I would like to ask the Flutter team, is this a normal phenomenon? Or because of what problems we have in packaging, the actual size of the generated package is different.

If it is a normal phenomenon, I hope the Flutter team can give some positive responses, and if it is because of any problems in our packaging, I hope the Flutter development team can provide a solution and direction, and whether other developers also have related questions.

I would be happy to discuss this issue further and provide any necessary assistance to explore whether there is a problem. The development of Ffltter is amazing, and I believe this solution can contribute to its continued success.

Thank you for taking the time to consider my question. I look forward to hearing your ideas and working together to make Flutter more efficient and easy to use for developers around the world.

@huycozy huycozy added the in triage Presently being triaged by the triage team label Nov 8, 2023
@huycozy
Copy link
Member

huycozy commented Nov 8, 2023

Hi @StarRookies
Unfortunately, I don't have more than one Windows machine to check this. Could you confirm this issue appears on a new Flutter project without using any plugins/packages?

It would be appreciated if you could check this with a Android native project as well. Thanks!

@huycozy huycozy added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Nov 8, 2023
@StarRookies
Copy link
Author

Hi @huycozy

Thank you for taking the time to answer my questions back and forth.

We did use some other good plugins/packages in our Flutter project.

But because the version is all the same and the code has not changed, I don't think this problem will arise because of the difference in the code.

Here I mainly want to know what factors affect the packet size and what factors in different Windows computers may cause the above problem.

Do you need some of Windows's own content during the packaging process, because different contents lead to different sizes of the generated APK packages?

Thank you again for your reply.

@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 Nov 9, 2023
@huycozy
Copy link
Member

huycozy commented Nov 9, 2023

But because the version is all the same and the code has not changed, I don't think this problem will arise because of the difference in the code.

Could you confirm package versions in use from pubspec.lock but not from pubspec.yaml?

Also, could you please share how you verify the apk/ipa file? (Did you use Android Studio for this?)

@huycozy huycozy added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Nov 9, 2023
@StarRookies
Copy link
Author

Thank you for taking the time to answer my questions back and forth.

Could you confirm package versions in use from pubspec.lock but not from pubspec.yaml?

The package used in Pubspec.lock is the specified version.

Also, could you please share how you verify the apk/ipa file? (Did you use Android Studio for this?)

Yes, I use Android Studio IDE for packaging.
How do you say to verify package, is to verify the size of package?
If so, check the size of the package through the details of apk and ipa.

@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 Nov 10, 2023
@huycozy
Copy link
Member

huycozy commented Nov 10, 2023

The package used in Pubspec.lock is the specified version.

Yes, it will be a specific version. Please make sure all fetched versions (in pubspec.lock) are the same between machines.

Also, please share the output of flutter doctor -v from each machine. Thanks!

@huycozy huycozy added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Nov 10, 2023
@StarRookies
Copy link
Author

StarRookies commented Nov 20, 2023

Yes, it will be a specific version. Please make sure all fetched versions (in pubspec.lock) are the same between machines.

We have ensured that the version of the content is consistent (in pubspec.lock).

Also, please share the output of flutter doctor -v from each machine. Thanks!

  • machin1:
PS D:\workspace\smartphone> flutter doctor -v
Flutter assets will be downloaded from https://storage.flutter-io.cn./ Make sure you trust this source!
[√] Flutter (Channel stable, 3.13.5, on Microsoft Windows [Version 10.0.19045.2728], locale ja-JP)
    • Flutter version 3.13.5 on channel stable at D:\flutter                                      
    • Upstream repository https://github.com/flutter/flutter.git                                  
    • Framework revision 12fccda598 (9 weeks ago), 2023-09-19 13:56:11 -0700                      
    • Engine revision bd986c5ed2                                                                  
    • Dart version 3.1.2                                                                          
    • DevTools version 2.25.0                                                                     
    • Pub download mirror https://pub.flutter-io.cn/                                               
    • Flutter download mirror https://storage.flutter-io.cn/                                       
                                                                                                  
[√] Windows Version (Installed version of Windows is version 10 or higher)                        

[!] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
    • Android SDK at C:\Users\Administrator\AppData\Local\Android\sdk
    X cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    X Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.

[X] Chrome - develop for the web (Cannot find Chrome executable at .\Google\Chrome\Application\chrome.exe)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.

[X] Visual Studio - develop Windows apps
    X Visual Studio not installed; this is necessary to develop Windows apps.
      Download at [https://visualstudio.microsoft.com/downloads/.](https://visualstudio.microsoft.com/downloads/)
      Please install the "Desktop development with C++" workload, including all of its default components

[√] Android Studio (version 2022.1)
    • Android Studio at C:\Program Files\Android\Android Studio
    • 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.15+0-b2043.56-9505619)

[√] Connected device (3 available)
    • Android SDK built for x86 (mobile) • emulator-5554 • android-x86    • Android 11 (API 30) (emulator)
    • Windows (desktop)                  • windows       • windows-x64    • Microsoft Windows [Version 10.0.19045.2728]
    • Edge (web)                         • edge          • web-javascript • Microsoft Edge 119.0.2151.72
    ! Device 24271JEGR13002 is not authorized.
      You might need to check your device for an authorization dialog.

[!] Network resources             
    X A network error occurred while checking "[https://github.com/":](https://github.com/%22:) セマフォがタイムアウトしました。


! Doctor found issues in 4 categories.
  • machin2:
PS C:\Users\Administrator\AndroidStudioProjects\sp> flutter doctor -v
[√] Flutter (Channel stable, 3.13.5, on Microsoft Windows [Version 10.0.19045.2006], locale ja-JP)
    • Flutter version 3.13.5 on channel stable at D:\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 12fccda598 (9 weeks ago), 2023-09-19 13:56:11 -0700
    • Engine revision bd986c5ed2
    • Dart version 3.1.2

[√] Chrome - develop for the web
    • Chrome at C:\Users\Administrator\AppData\Local\Google\Chrome\Application\chrome.exe

[X] Visual Studio - develop Windows apps
    X Visual Studio not installed; this is necessary to develop Windows apps.
      Download at [https://visualstudio.microsoft.com/downloads/.](https://visualstudio.microsoft.com/downloads/)
      Please install the "Desktop development with C++" workload, including all of its default components

[√] Android Studio (version 2022.1)
    • Android Studio at C:\Program Files\Android\Android Studio
    • 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.15+0-b2043.56-9505619)

[√] Connected device (3 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.19045.2006]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 107.0.5304.88
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 119.0.2151.72

[!] Network resources                                                                                      
    X A network error occurred while checking "[https://maven.google.com/":](https://maven.google.com/%22:) セマフォがタイムアウトしました。
                                                                                                           
    X A network error occurred while checking "[https://github.com/":](https://github.com/%22:) セマフォがタイムアウトしました。      
                                                                                                           
                                                                                                           
! Doctor found issues in 3 categories.

@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 Nov 20, 2023
@huycozy
Copy link
Member

huycozy commented Nov 21, 2023

Thanks for the update. Perhaps someone from tool team can help to explain this phenomenon.

@huycozy huycozy added tool Affects the "flutter" command-line tool. See also t: labels. a: size Reducing IPA/APK/JS sizes a: build Building flutter applications with the tool team-tool Owned by Flutter Tool team platform-android Android applications specifically platform-ios iOS applications specifically and removed in triage Presently being triaged by the triage team labels Nov 21, 2023
@StarRookies
Copy link
Author

Thank you very much for your reply.

I hope you can give me a more useful reply, our team is confused about this question now.

@StarRookies
Copy link
Author

Hi @huycozy

I'm so sorry to bother you again.

With regard to this question, it may be very difficult to investigate why it caused this phenomenon.

However, I would like to know whether this phenomenon is normal. Will not have an impact on the project.

We look forward to your reply.

Thank you very much.

@huycozy
Copy link
Member

huycozy commented Dec 8, 2023

Hi @StarRookies, I will escalate this issue to the team. Thanks for your patience.

@huycozy huycozy changed the title On different machines, the same App is packaged to generate Android xxx.apk or iOS xxx.ipa packages of different sizes. [Android][iOS] Builds generated on different machines have different sizes Dec 8, 2023
@StarRookies
Copy link
Author

StarRookies commented Dec 9, 2023

Hi @huycozy , Thank you very much for your reply.

I look forward to hearing from your team very much.

@StarRookies
Copy link
Author

Hi @huycozy,

If this question is difficult to answer, in other words, does the developer need to care about it?
After testing, we found that although the packaging sizes of the two machines are different, both of them can perform normally.
If it is really a problem with the flutter packaging mechanism, is there any update plan in the future?

@christopherfujino christopherfujino added P3 Issues that are less important to the Flutter project triaged-tool Triaged by Flutter Tool team labels Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a: build Building flutter applications with the tool a: size Reducing IPA/APK/JS sizes P3 Issues that are less important to the Flutter project platform-android Android applications specifically platform-ios iOS applications specifically team-tool Owned by Flutter Tool team tool Affects the "flutter" command-line tool. See also t: labels. triaged-tool Triaged by Flutter Tool team
Projects
None yet
Development

No branches or pull requests

3 participants