What is the difference between 3 APKs generated from flutter?

ε祈祈猫儿з 提交于 2020-02-07 02:36:21

问题


I need to understand the Android device architecture and, Why there is three different types of APKs are generated when I use:

flutter build apk --split-per-abi.

And when I use

flutter build apk

I get a large APK file called fat APK contains the 3 versions of the app.


回答1:


flutter build apk gives you large apk because,

flutter build apk results in a fat APK that contains your code compiled for all the target ABIs. Such APKs are larger in size than their split counterparts, causing the user to download native binaries that are not applicable to their device’s architecture.


--split-per-abi results in two APK files:

(The flutter build command defaults to --release.)

<app dir>/build/app/outputs/apk/release/app-armeabi-v7a-release.apk
<app dir>/build/app/outputs/apk/release/app-arm64-v8a-release.apk

Where armeabi-v7a for is 32-bit devices and arm64-v8a for 64-bit devices.

Read More on
https://flutter.dev/docs/deployment/android#build-an-apk
https://flutter.dev/docs/deployment/android#build-an-app-bundle
https://developer.android.com/studio/build/configure-apk-splits#configure-split




回答2:


The command flutter build apk --split-per-abi typically generates two APK files.

  1. arm64 or x86_64 is the apk file for devices having 64-bit processors.
  2. x86 is the apk file for 32-bit processors.

You can upload both of them on the PlayStore and based on the user's device architecture the corresponding apk will be installed.

The fat apk that you are getting while using the flutter build apk contains the necessary compiled code to target all the Application Binary Interfaces or ABIs. Once a user downloads this fat apk, then only the code applicable to the device will be used.



来源:https://stackoverflow.com/questions/59336535/what-is-the-difference-between-3-apks-generated-from-flutter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!