Flutter构建apk无法正常工作,并显示Gradle任务assembleRelease失败,退出代码为1 [英] Flutter build apk doesn't work and shows Gradle task assembleRelease failed with exit code 1

查看:643
本文介绍了Flutter构建apk无法正常工作,并显示Gradle任务assembleRelease失败,退出代码为1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

This is the error I get when building the app:

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

This is the output of flutter run -v command: https://controlc.com/3bc5e348

谢谢.

推荐答案

该错误显然为您提供了构建APK的两个选项.如果您尝试将其上传到Play商店,则创建应用程序捆绑可能是最好的选择.只需按照错误指示生成应用包:

The error clearly gives you two options to build your APK. If you're trying to upload it to the Play store then creating an app bundle is probably the best option. Just generate app bundle as instructed in the error:

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

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

This will create .aab file in your release folder - <app dir>/build/app/outputs/bundle/release/app.aab

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

You should then be able to upload this aab file to Play store.

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

The second option in the error message above will generate two APKs (one for 32-bit and one for 64-bit).

关于此的更多信息- Flutter网站

祝你好运!

这篇关于Flutter构建apk无法正常工作,并显示Gradle任务assembleRelease失败,退出代码为1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆