เกิดข้อผิดพลาดเมื่อสร้าง APK จาก Flutter Project

ฉันประสบปัญหาเมื่อพยายามสร้าง APK จากโปรเจ็กต์ที่กระพือปีกของฉัน ฉันใช้ appicon.co เพื่อสร้างไอคอนแอป

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...                                              1.4s
Resolving dependencies...                                           6.4s
                                                                        
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeReleaseResources'.
> java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource compilation failed
  Output:  D:\projects\e-cal app\ECAL appication\ecal\android\app\src\main\res\mipmap-hdpi\ic_launcher.png: error: failed to read PNG signature: file does not start with PNG signature.

  Command: C:\Users\DELL\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\dc6524cdbb29b6d93306387944c512dd\aapt2-3.2.1-4818971-windows\aapt2.exe compile --legacy \
          -o \
          D:\projects\e-cal app\ECAL appication\ecal\build\app\intermediates\res\merged\release \
          D:\projects\e-cal app\ECAL appication\ecal\android\app\src\main\res\mipmap-hdpi\ic_launcher.png
  Daemon:  AAPT2 aapt2-3.2.1-4818971-windows Daemon #1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done                      76.4s
*******************************************************************************************
The Gradle failure may have been because of AndroidX incompatibilities in this Flutter app.
*******************************************************************************************
Gradle task assembleRelease failed with exit code 1

จะแก้ไขปัญหานั้นได้อย่างไร? ใครสามารถช่วยได้โปรด


person Pasan Madhushan    schedule 29.07.2020    source แหล่งที่มา


คำตอบ (1)


ฉันไม่แน่ใจ แต่เมื่อสร้างคุณควรพยายามสร้าง App Bundle เนื่องจากไม่ได้ใช้พื้นที่มากนักและจะทำให้ผู้คนมีแนวโน้มที่จะได้รับแอปของคุณมากขึ้น

person Colly    schedule 29.07.2020