我已经为我的项目制作了.apk
文件,它的重量为19.4MB,这正常吗?我使用了命令:
flutter build apk --release
该命令的确生成和apk文件,但是输出以下消息:
You are building a fat APK that includes binaries for android-arm, android-arm64, android-x64.
If you are deploying the app to the Play Store, it's recommended to use app bundles or split the APK to reduce the APK size.
To generate an app bundle, run:
flutter build appbundle --target-platform android-arm,android-arm64,android-x64
Learn more on: https://developer.android.com/guide/app-bundle
To split the APKs per ABI, run:
flutter build apk --target-platform android-arm,android-arm64,android-x64 --split-per-abi
Learn more on: https://developer.android.com/studio/build/configure-apk-splits#configure-abi-split
20MB是正常大小,但您的大多数应用大小是由android-arm,android-arm64和android-x64的二进制文件贡献的。在特定设备中,根据设备硬件即设备的abi,将仅使用二进制文件之一。
建议使用应用捆绑包,因为Google会为每个abi自动创建APK,从而减小了应用的大小。
例如,Play商店将为android-arm,android-arm64和android-x64 ABI创建单独的apk。
是的,对于apk文件来说很正常。您已经为x64,arm等多进程支持构建了二进制文件,这就是为什么大小更大的原因。但这不会造成任何问题。您可以通过仅针对要在其上运行应用程序的目标平台构建二进制文件来减小apk的大小。