找不到名为 "split-per-abi" 的选项
Could not find an option named "split-per-abi"
请问什么版本的 flutter 在使用 flutter build apk
构建 APK 文件时支持 --split-per-abi
选项。我正在使用 Flutter 1.5.4-hotfix.2
,但仍然无法访问该选项。
根据文档 Preparing an Android app for release、
This command results in two APK files:
<app dir>/build/app/outputs/apk/release/app-armeabi-v7a-release.apk
<app dir>/build/app/outputs/apk/release/app-arm64-v8a-release.apk
Removing the --split-per-abi flag 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.
我怎样才能让它发挥作用?
编辑: 它适用于 Flutter 1.7.4
在您的 <app dir>/android/app/build.gradle
中添加一个 splits
部分,如下所述:https://developer.android.com/studio/build/configure-apk-splits#configure-abi-split
基本配置是将其添加到您的 build.gradle
android {
...
splits {
// Configures multiple APKs based on ABI.
abi {
// Enables building multiple APKs per ABI.
enable true
// By default all ABIs are included, so use reset() and include to specify that we only
// want APKs for x86 and x86_64.
// Resets the list of ABIs that Gradle should create APKs for to none.
reset()
// Specifies a list of ABIs that Gradle should create APKs for.
include "x86", "x86_64", "armeabi", "armeabi-v7a", "arm64-v8a"
// Specifies that we do not want to also generate a universal APK that includes all ABIs.
universalApk false
}
}
}
然后 运行 文档中说的命令:
flutter build apk --split-per-abi
以下是支持的 ABI 列表:
https://developer.android.com/ndk/guides/abis.html#sa
使用上面的配置你应该得到所有支持的 ABIs
请问什么版本的 flutter 在使用 flutter build apk
构建 APK 文件时支持 --split-per-abi
选项。我正在使用 Flutter 1.5.4-hotfix.2
,但仍然无法访问该选项。
根据文档 Preparing an Android app for release、
This command results in two APK files:
<app dir>/build/app/outputs/apk/release/app-armeabi-v7a-release.apk <app dir>/build/app/outputs/apk/release/app-arm64-v8a-release.apk
Removing the --split-per-abi flag 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.
我怎样才能让它发挥作用?
编辑: 它适用于 Flutter 1.7.4
在您的 <app dir>/android/app/build.gradle
中添加一个 splits
部分,如下所述:https://developer.android.com/studio/build/configure-apk-splits#configure-abi-split
基本配置是将其添加到您的 build.gradle
android {
...
splits {
// Configures multiple APKs based on ABI.
abi {
// Enables building multiple APKs per ABI.
enable true
// By default all ABIs are included, so use reset() and include to specify that we only
// want APKs for x86 and x86_64.
// Resets the list of ABIs that Gradle should create APKs for to none.
reset()
// Specifies a list of ABIs that Gradle should create APKs for.
include "x86", "x86_64", "armeabi", "armeabi-v7a", "arm64-v8a"
// Specifies that we do not want to also generate a universal APK that includes all ABIs.
universalApk false
}
}
}
然后 运行 文档中说的命令:
flutter build apk --split-per-abi
以下是支持的 ABI 列表: https://developer.android.com/ndk/guides/abis.html#sa
使用上面的配置你应该得到所有支持的 ABIs