【问题标题】:what is the problem in build .apk file in flutter in this case?在这种情况下,在颤振中构建 .apk 文件有什么问题?
【发布时间】:2020-04-03 01:13:03
【问题描述】:

我最近在 Flutter 中写了一个名为 app002 的应用程序,但是我遇到了一些问题我需要知道如何解决它们,我使用 GitBash 作为终端

颤振医生

 lamoh@DESKTOP-QUA3N6C MINGW64 /e/programes/Flutter_Req/sourceCode
$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, v1.9.1+hotfix.6, on Microsoft Windows [Version 10.0.15063], locale ar-DZ)
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[√] Android Studio (version 3.5)
[√] VS Code, 64-bit edition (version 1.40.2)
[!] Connected device
    ! No devices available

! Doctor found issues in 1 category.

这个命令花费了太多时间并且没有被执行

颤振构建apk

elamoh@DESKTOP-QUA3N6C MINGW64 /e/programes/Flutter_Req/sourceCode/app002
$ flutter build apk
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...                                              2,0s
Resolving dependencies...

我也尝试过,但没有任何效果

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

    lamoh@DESKTOP-QUA3N6C MINGW64 /e/programes/Flutter_Req/sourceCode/app002
**$ flutter build appbundle --target-platform android-arm,android-arm64**
Initializing gradle...                                              2,3s
Resolving dependencies...

在项目目录中创建了一个名为 build 的文件夹,但里面只有 app.dill 文件存在。没有 apk 没有 iOS 文件

请帮忙!!! 谢谢

【问题讨论】:

标签: flutter apk avd


【解决方案1】:

您需要运行 flutter build apk 而不是 appbundle。应用程序包旨在发送到 Google Play,它将为您生成和优化 apk。完成后,apk 将位于 build\app\outputs\bundle\release\ 文件夹中。

【讨论】:

    【解决方案2】:

    最后它需要很长时间,但它已经完成了,谢谢

    PS E:\programes\Flutter_Req\sourceCode\app003> flutter build appbundle --target-platform android-arm,android-arm64
    Running "flutter pub get" in app003...                              8,9s
    Initializing gradle...                                              6,4s
    Resolving dependencies...
      520,4s (!)
    Running Gradle task 'bundleRelease'...
    
    Running Gradle task 'bundleRelease'... Done                       314,3s (!)
    Built build\app\outputs\bundle\release\app.aab (10.5MB).
    

    我可以在哪里找到 APK 文件!

    【讨论】:

      【解决方案3】:

      你的应用程序太大了,要减小它的大小,运行这个

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

      然后运行这个

      flutter build apk --target-platform android-arm,android-arm64,android-x64 --split-per-abi
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2020-06-13
        • 1970-01-01
        • 2020-08-25
        • 2020-12-18
        • 2017-07-09
        • 1970-01-01
        • 2021-11-16
        相关资源
        最近更新 更多