flutter build_error ai_generated true

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

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

Also available as: JSON · Markdown · 中文
80%Fix Rate
83%Confidence
1Evidence
2024-02-18First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
Flutter 3.16 active
Flutter 3.19 active
Gradle 8.0 active
Gradle 8.2 active

Root Cause

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

中文

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

Official Documentation

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

Workarounds

  1. 85% success Run 'flutter clean' followed by 'flutter pub get' and 'cd android && ./gradlew clean' to clear all caches, then rebuild.
    Run 'flutter clean' followed by 'flutter pub get' and 'cd android && ./gradlew clean' to clear all caches, then rebuild.
  2. 78% success 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.
    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. 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.

Dead Ends

Common approaches that don't work:

  1. 65% fail

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

  2. 70% fail

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

  3. 80% fail

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