gpt4 book ai didi

flutter - 如何解决 "Execution failed for task ' :app:compileFlutterBuildDebug'."

转载 作者:行者123 更新时间:2023-12-03 13:29:13 34 4
gpt4 key购买 nike

当我尝试在终端中使用“flutter run”在 android 上运行应用程序时,出现以下错误...

/C:/Users/Acer/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/provider-3.2.0/lib/src/delegate_widget.dart:194:18: Error: Superclass has no method named 'inheritFromElement'.
return super.inheritFromElement(ancestor, aspect: aspect);
^^^^^^^^^^^^^^^^^^
/C:/Users/Acer/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/provider-3.2.0/lib/src/provider.dart:259:19: Error: The method 'inheritFromWidgetOfExactType' isn't defined for the class 'BuildContext'.
- 'BuildContext' is from 'package:flutter/src/widgets/framework.dart' ('/D:/Flutter/flutter/packages/flutter/lib/src/widgets/framework.dart').
Try correcting the name to the name of an existing method, or defining a method named 'inheritFromWidgetOfExactType'.
? context.inheritFromWidgetOfExactType(type) as InheritedProvider<T>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/C:/Users/Acer/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/provider-3.2.0/lib/src/provider.dart:260:19: Error: The method 'ancestorInheritedElementForWidgetOfExactType' isn't defined for the class 'BuildContext'.
- 'BuildContext' is from 'package:flutter/src/widgets/framework.dart' ('/D:/Flutter/flutter/packages/flutter/lib/src/widgets/framework.dart').
Try correcting the name to the name of an existing method, or defining a method named 'ancestorInheritedElementForWidgetOfExactType'.
: context.ancestorInheritedElementForWidgetOfExactType(type)?.widget
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/C:/Users/Acer/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/flutter_svg-0.18.1/lib/src/picture_provider.dart:50:59: Error: No named parameter with
the name 'nullOk'.
context != null ? Localizations.localeOf(context, nullOk: true) : null,
^^^^^^
/D:/Flutter/flutter/packages/flutter/lib/src/widgets/localizations.dart:413:17: Context: Found this candidate, but the arguments don't match.
static Locale localeOf(BuildContext context) {
^^^^^^^^


FAILURE: Build failed with an exception.

* Where:
Script 'D:\Flutter\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 991

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'D:\Flutter\flutter\bin\flutter.bat'' 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 1m 50s
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done 121.0s
Exception: Gradle task assembleDebug failed with exit code 1

问题是昨天它工作正常,但今天它显示此错误消息。
请帮忙解决。

最佳答案

您可能在“稳定”以外的 channel 中升级了 flutter 。
在这种情况下,最简单的解决方案是简单地打开一个终端并运行 (type)flutter downgrade .

关于flutter - 如何解决 "Execution failed for task ' :app:compileFlutterBuildDebug'.",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65967833/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com