简体   繁体   中英

Flutter build apk doesn't work and shows Gradle task assembleRelease failed with exit code 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

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

Thanks in advance.

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

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

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

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

More about this - Flutter site

Good luck!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM