【问题标题】:Flutter build apk doesn't work and shows Gradle task assembleRelease failed with exit code 1Flutter build apk 不起作用并显示 Gradle task assembleRelease failed with exit code 1
【发布时间】:2019-11-27 14:46:13
【问题描述】:

这是我在构建应用程序时遇到的错误:

You are building a fat APK that includes binaries for android-arm, android-arm64.
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
        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 --split-per-abi
        Learn more on:  https://developer.android.com/studio/build/configure-apk-splits#configure-abi-split
Initializing gradle...                                              0.5s
Resolving dependencies...                                           2.0s
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done                      79.9s
Gradle task assembleRelease failed with exit code 1

这是 flutter run -v 命令的输出: https://controlc.com/3bc5e348

提前致谢。

【问题讨论】:

    标签: android flutter mobile-application


    【解决方案1】:

    该错误清楚地为您提供了两种构建 APK 的选项。如果您尝试将其上传到 Play 商店,那么创建应用程序包可能是最佳选择。只需按照错误中的说明生成 app bundle:

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

    这将在您的发布文件夹中创建 .aab 文件 - <app dir>/build/app/outputs/bundle/release/app.aab

    然后您应该可以将此 aab 文件上传到 Play 商店。

    上述错误消息中的第二个选项将生成两个 APK(一个用于 32 位,一个用于 64 位)。

    更多信息 - Flutter site

    祝你好运!

    【讨论】:

      猜你喜欢
      • 2021-09-04
      • 1970-01-01
      • 1970-01-01
      • 2020-11-06
      • 1970-01-01
      • 2020-06-22
      • 2021-12-30
      • 1970-01-01
      • 2020-08-22
      相关资源
      最近更新 更多