项目环境:
$ flutter --version
Flutter 2.5.3 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 18116933e7 (1 year, 6 months ago) • 2021-10-15 10:46:35 -0700
Engine • revision d3ea636dc5
Tools • Dart 2.14.4
$
$ java -version
java version "1.8.0_20"
$ vscode -version
Version: 1.77.0
Commit: 7f329fe6c66b0f86ae1574c2911b681ad5a45d63
Date: 2023-03-29T09:57:11.797Z
Electron: 19.1.11
Chromium: 102.0.5005.196
Node.js: 16.14.2
V8: 10.2.154.26-electron.0
OS: Darwin x64 19.6.0
Sandboxed: No
运行或编译 Android 项目时,出现以下错误:
# flutter build apk
Running "flutter pub get" in f2test... 1,497ms
💪 Building with sound null safety 💪
FAILURE: Build failed with an exception.
* Where:
Build file '/Project/test/FlutterDemo/F2Test/f2test/android/app/build.gradle' line: 24
* What went wrong:
A problem occurred evaluating project ':app'.
> Could not initialize class com.android.build.gradle.internal.TaskManager
* 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 3s
Running Gradle task 'assembleRelease'... 5.0s
Gradle task assembleRelease failed with exit code 1