2

我想生成支持的apk文件:'armeabi-v7a','arm64-v8a','x86','x86_64'

我使用了命令:

flutter build apk --flavor production

并且

flutter build appbundle --target-platform android-arm,android-arm64

结果总是只有 arm64-v8a 和 armeabi-v7a

我试图在 android/build.gradle 中更改 defaultConfig

defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "XXX"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode VERSION_CODE
        versionName flutterVersionName
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

        manifestPlaceholders = [AppLabelName: "XXX"]
        multiDexEnabled true
        ndk  {
            abiFilters 'armeabi-v7a','arm64-v8a','x86','x86_64'
        }
    }`

然后运行

flutter build apk --flavor production

仍然没有工作,当我尝试对其进行测试时

ASUS T00P • EAAZCY03U504 • android-arm • Android 4.4.2 (API 19)

它总是显示错误

Performing Push Install
build\app\outputs\apk\production\release\app-production-release.apk: 1 file pushed. 3.5 MB/s (33320272 bytes in 9.085s)
        pkg: /data/local/tmp/app-production-release.apk
Failure [INSTALL_FAILED_MEDIA_UNAVAILABLE]
4

1 回答 1

0

AFAIK,官方文档指出尚不提供对 x86 Android 的支持:

在发布模式下构建应用程序时,可以针对 armeabi-v7a(ARM 32 位)、 arm64-v8a (ARM 64 位)和 x86-64(x86 64 位)编译 Flutter 应用程序。Flutter 目前不支持为 x86 Android 构建(参见问题 9253)。

这里也是

  • 我们支持和测试在各种低端到高端平台上运行 Flutter。有关我们测试的平台的详细列表,请参阅支持的平台列表。

  • Flutter 支持为x86_64armeabi-v7aarm64-v8a.

  • 为 ARMv7 或 ARM64 构建的应用程序在许多 x86 Android 设备上运行良好(使用 ARM 仿真)。

  • 我们支持在一系列平台上开发 Flutter 应用程序。请参阅每个开发操作系统下列出的系统要求。

关于在 x86(32 位)中构建的支持,在这个 GitHub 线程中提到:

在 master 上,Flutter 现在支持 x86_64(64 位)Android ABI。该引擎还支持按照 https://github.com/flutter/flutter/wiki/JIT-Release-Modes上的说明构建 x86(32 位)

于 2022-02-22T00:35:34.720 回答