Flutter误差-失效:生成失败,出现异常

toiithl6  于 2023-01-18  发布在  Flutter
关注(0)|答案(3)|浏览(167)

昨天,我运行我的应用程序只是为了睡前检查。突然,问题出现了,我尝试了几乎所有的stackoverflow来解决它,但没有一个可以解决问题。这个问题出现字面上的“突然”。我现在很困惑,因为我没有做任何事情之前,我运行的应用程序。有没有一个单一的变化后,我的应用程序检查了5分钟前。但现在,它只是可以建立我做什么。请给予我任何建议,我会这样做。这里是错误信息。

FAILURE: Build failed with an exception.

* Where:
Script '/Users/Documents/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 1156

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command '/Users/Documents/flutter/bin/flutter'' 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 42s
Exception: Gradle task assembleDebug failed with exit code 1

***and here is flutter doctor result***


[✓] Flutter (Channel stable, 3.0.2, on macOS 12.3.1 21E258 darwin-x64)
    • Flutter version 3.0.2 at /Users/Documents/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision cd41fdd495 (6 days ago), 2022-06-08 09:52:13 -0700
    • Engine revision f15f824b57
    • Dart version 2.17.3
    • DevTools version 2.12.2

[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
    • Android SDK at /Users/Library/Android/sdk
    • Platform android-32, build-tools 32.1.0-rc1
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)

[✓] VS Code (version 1.66.0)
    • VS Code at /Users/Downloads/Visual Studio Code.app/Contents
    • Flutter extension can be installed from:
      🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (3 available)
    • macOS (desktop)   • macos       • darwin-x64     • macOS 12.3.1 21E258 darwin-x64
    • Chrome (web)      • chrome      • web-javascript • Google Chrome 102.0.5005.61

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!
7d7tgy0s

7d7tgy0s1#

我终于成功运行了这个应用程序!我只是删除了所有的文件并更新了android studio,然后从github克隆了我的应用程序并再次运行。它工作了!但我真的不知道是什么导致了这个问题。

cfh9epnr

cfh9epnr2#

请尝试以下步骤:

第一次运行flutter clean
然后使用android studio只打开android项目文件夹,android studio将开始同步你的项目成绩。(这可能需要一些时间取决于网速)

如果这android studio没有开始同步你由它自己或失败在这期间,点击这同步按钮.

返回flutter项目运行flutter pub get并尝试运行应用程序。

ego6inou

ego6inou3#

  • 第一个flutter clean
  • 然后运行flutter pub get
  • 然后运行flutter pub upgrade
  • 然后尝试运行dart迁移。
  • 并检查您的构建等级是否存在错误

相关问题