应用程序在代码中编译Flutter Build Debug Error

时间:2020-06-25 14:52:35

标签: flutter dart

在构建flutter项目时遇到此问题,但较早的同一个项目运行正常,我无法理解该问题。

Launching lib\main.dart on Nokia 3 1 in debug mode...
Running Gradle task 'assembleDebug'...                                  

Oops; flutter has exited unexpectedly.
Crash report written to C:\Users\hp\Desktop\schoolbells\flutter_02.log;
please let us know at https://github.com/flutter/flutter/issues.

FAILURE: Build failed with an exception.

* Where:
Script 'C:\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 780

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\flutter\bin\flutter.bat'' finished with non-zero exit value 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.

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

BUILD FAILED in 7m 3s
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done                       431.2s (!)
Gradle task assembleDebug failed with exit code 1

2 个答案:

答案 0 :(得分:0)

我以前遇到过此错误。

尝试添加

         multiDexEnabled true

到android / app / build.gradle

defaultConfig {
     
        applicationId "com.your_app.your_app"
        minSdkVersion 21
        targetSdkVersion 28
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
         //Add this Line
        multiDexEnabled true
    }

答案 1 :(得分:0)

如果主文件名为main_prod,则将其重命名为“ main.dart”。 之后,执行以下命令: “干净”,应该修复它。