flutter build_error ai_generated true

Gradle 任务 assembleDebug 失败,退出码 1:任务 ':app:compileFlutterBuildDebugArm64' 执行失败

Gradle task assembleDebug failed with exit code 1: Execution failed for task ':app:compileFlutterBuildDebugArm64'

ID: flutter/gradle-execution-failed-for-task-compiledartkernel

其他格式: JSON · Markdown 中文 · English
80%修复率
83%置信度
1证据数
2024-02-18首次发现

版本兼容性

版本状态引入弃用备注
Flutter 3.16 active — — —
Flutter 3.19 active — — —
Gradle 8.0 active — — —
Gradle 8.2 active — — —

根因分析

Gradle 构建期间 Flutter Dart 编译步骤失败,原因包括缓存损坏、Dart SDK 版本不兼容或目标架构(arm64)缺少原生依赖。

English

The Flutter Dart compilation step fails during a Gradle build due to issues like corrupted cache, incompatible Dart SDK version, or missing native dependencies for the target architecture (arm64).

generic

官方文档

https://docs.flutter.dev/deployment/android#build-the-app

解决方案

  1. Run 'flutter clean' followed by 'flutter pub get' and 'cd android && ./gradlew clean' to clear all caches, then rebuild.
  2. Check the full error log for specific Dart compilation errors (e.g., syntax errors, missing imports) and fix them; also ensure the Dart SDK version matches the project constraints in pubspec.yaml.

无效尝试

常见但无效的做法:

  1. 65% 失败

    The Gradle cache or Dart kernel snapshots may still be corrupted; a full clean is often needed.

  2. 70% 失败

    May introduce breaking changes or dependency conflicts that cause other build failures.

  3. 80% 失败

    If the error is due to code issues or cache corruption, more memory won't help.