我试图使用颤振包例子‘图像编辑器专业’,但当我运行调试它给我这个错误,我尝试‘颤振清洁’和升级一切,但问题仍然存在。我在原始代码中添加了一些与空安全更新兼容的内容,但没有其他内容。
Launching lib/main.dart on SM G970U1 in debug mode...
Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/03 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/03 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/03 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
: Error: The argument type 'PointerEvent' can't be assigned to the parameter type 'PointerDownEvent'.
- 'PointerEvent' is from 'package:flutter/src/gestures/events.dart' ('../../../snap/flutter/common/flutter/packages/flutter/lib/src/gestures/events.dart').
- 'PointerDownEvent' is from 'package:flutter/src/gestures/events.dart' ('../../../snap/flutter/common/flutter/packages/flutter/lib/src/gestures/events.dart').
super.addAllowedPointer(event);
^
: Error: The getter 'body2' isn't defined for the class 'TextTheme'.
- 'TextTheme' is from 'package:flutter/src/material/text_theme.dart' ('../../../snap/flutter/common/flutter/packages/flutter/lib/src/material/text_theme.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'body2'.
themeData.primaryTextTheme.body2)
^^^^^
: Error: The getter 'body2' isn't defined for the class 'TextTheme'.
- 'TextTheme' is from 'package:flutter/src/material/text_theme.dart' ('../../../snap/flutter/common/flutter/packages/flutter/lib/src/material/text_theme.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'body2'.
themeData.primaryTextTheme.body2)
^^^^^
: Error: The getter 'body2' isn't defined for the class 'TextTheme'.
- 'TextTheme' is from 'package:flutter/src/material/text_theme.dart' ('../../../snap/flutter/common/flutter/packages/flutter/lib/src/material/text_theme.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'body2'.
themeData.primaryTextTheme.body2.color;
^^^^^
: Error: Too many positional arguments: 1 allowed, but 2 found.
Try removing the extra positional arguments.
super.addToScene(builder, layerOffset);
^
FAILURE: Build failed with an exception.
* Where:
Script '/home/criuser/snap/flutter/common/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 1102
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command '/home/criuser/snap/flutter/common/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 54s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
发布于 2022-02-03 23:54:37
在项目的android目录中打开终端。尝试使用以下命令清理和重建gradle:(在windows上)
Gradlew clean
然后:
Gradlew build
如果您使用的是mac或linux,请注意:
./gradlew clean
./gradlew build
https://stackoverflow.com/questions/70979306
复制相似问题