Flutter:异常释放大小

问题描述 投票:0回答:1

同时在两个平台上构建时,我都注意到以下内容:

  • app.ipa 190MB,
  • Runner-427,3Mb
  • Apk 7,2MB
[✓] Flutter (Channel stable, v1.12.13+hotfix.5, on Mac OS X 10.14.5 18F132, locale en-IT)
• Flutter version 1.12.13+hotfix.5 at /Users/cosminrus/Utils/flutter
• Framework revision 27321eb (3 months ago), 2019-12-10 18:15:01 -0800
• Engine revision 2994f7e1e6
• Dart version 2.7.0

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at /Users/cosminrus/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.2
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.3)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.3, Build version 11C29
• CocoaPods version 1.8.4

[✓] Android Studio (version 3.5)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 42.1.1
• Dart plugin version 191.8593
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)

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

[!] Connected device
! No devices available

! Doctor found issues in 1 category.
ios flutter size
1个回答
0
投票

Flutter构建大小取决于正在使用的构建执行。就上下文而言,JITAOT是Flutter使用的两个真正强大的逻辑。

  • JIT:允许进行热重装并查看实时更改,缺点是构建量很大。
  • AOT:构建在允许Flutter全速运行的本机代码上,构建尺寸更小。

在调试和发布模式下检查其大小时,您也会在Android上注意到这一点。

为了更好地了解应用程序的大小,请在终端上运行以下命令:

Android

flutter build apk --split-per-abi

并检查输出文件的大小。

iOS

flutter build ios && tar -zcf build/app.ipa build/ios/iphoneos/Runner.app && ls -lh build/app.ipa

如果要深入研究减小文件大小,请遵循此LINK。而且,如果您想知道为什么iOS版本更大,请检查此LINK

如果您有兴趣,可以使用正式的DOCS作为构建尺寸。

© www.soinside.com 2019 - 2024. All rights reserved.