Flutter构建Apk:构建无法通知构建完成侦听器

时间:2018-10-30 10:27:12

标签: build flutter release

我已经安装了Flutter,并且没有任何问题,我可以编写代码并构建调试apk和热重载,但是无法构建应用程序的发行版。

这是CommandPrompt中的“ flutter doctor -v”和“ flutter build apk”信息。

C:\ eew>颤抖的医生-v

<ion-range min="-200" max="200" [(ngModel)]="saturation" color="secondary" pin="true">

C:\ eew> flutter构建apk

**[√]** Flutter (Channel dev, v0.10.1, on Microsoft Windows [Version 10.0.14393], locale en-US)
    • Flutter version 0.10.1 at C:\src\flutter
    • Framework revision 6a3ff018b1 (11 days ago), 2018-10-18 18:38:26 -0400
    • Engine revision 3860a43379
    • Dart version 2.1.0-dev.7.1.flutter-b99bcfd309

**[√]** Android toolchain - develop for Android devices (Android SDK 27.0.3)
    • Android SDK at C:\Users\Scott Robertson\AppData\Local\Android\sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 27.0.3
    • Java binary at: E:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)
    • All Android licenses accepted.

**[√]** Android Studio (version 3.1)
    • Android Studio at E:\Program Files\Android\Android Studio
    • Flutter plugin version 29.0.1
    • Dart plugin version 173.4700
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)

**[√]** VS Code, 64-bit edition (version 1.28.2)
    • VS Code at C:\Program Files\Microsoft VS Code
    • Flutter extension version 2.19.0

**[√]** Connected device (1 available)
    • SM G610F • 5203698b48575407 • android-arm • Android 7.0 (API 24)

• No issues found!

这是“ flutter build -v apk”信息

Initializing gradle...                                       1.9s
Resolving dependencies...                                    4.5s
Gradle task 'assembleRelease'...

FAILURE: Build failed with an exception.

* What went wrong:
Failed to notify build completion listener.
> com.android.tools.lint.LintCoreApplicationEnvironment

* 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.

* Get more help at https://help.gradle.org

BUILD FAILED in 35s
Gradle task 'assembleRelease'... Done                       37.1s
Gradle task assembleRelease failed with exit code 1

1 个答案:

答案 0 :(得分:0)

将flutter beta频道从v0.10.2升级到v0.11.3之后,我遇到了同样的问题。我花了几个小时找出这个问题。 希望这也对您有用:

方法1:

  • 将文件夹android重命名为android.save
  • 创建另一个名为dummy的Flutter项目
  • 从虚拟项目中复制android文件夹
  • android\app文件夹替换为先前保存的文件夹(android.save\app
  • 运行一个干净的版本: flutter clean;flutter build apk --release --verbose

方法2:

切换到另一个颤动通道,然后再切换回也可以解决此问题。它在另一台机器上对我有用。