Flutter 颤振项目编译失败,带有“FARTER”;任务执行失败';fluttoast:compiledBugJavawithJavaC'&引用;安卓利德

Flutter 颤振项目编译失败,带有“FARTER”;任务执行失败';fluttoast:compiledBugJavawithJavaC'&引用;安卓利德,flutter,flutter-dependencies,Flutter,Flutter Dependencies,我在这里回答我自己的问题,因为我经过几个小时的搜索才解决了这个问题。这不是一个已经回答过的问题,所以请不要这样标记它。我希望是这样,这样我就不会有几个小时的沮丧了 颤振项目因此错误而失败。这是一个错误 ??: ?? ContextCompat ??: ? FluttertoastPlugin 2 ??? FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':flu

我在这里回答我自己的问题,因为我经过几个小时的搜索才解决了这个问题。这不是一个已经回答过的问题,所以请不要这样标记它。我希望是这样,这样我就不会有几个小时的沮丧了

颤振项目因此错误而失败。这是一个错误

??:   ?? ContextCompat
  ??: ? FluttertoastPlugin
2 ???

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':fluttertoast:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* 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 26s
    *******************************************************************************************
    The Gradle failure may have been because of AndroidX incompatibilities in this Flutter app.
    See https://flutter.dev/docs/development/packages-and-plugins/androidx-compatibility for more information on the problem and how to fix it.
    *******************************************************************************************
    Finished with error: Gradle task assembleDebug failed with exit code 1

根本问题是flattertoastplugin.java中的android.support.v4.Content.ContextCompat导入无法解析符号ContextCompat。这是一个依赖性问题

解决方案是转到Flatter项目的pubspec.yaml,找到FlatterToast依赖项并将其更新为最新版本(当前为^3.1.0)

依赖项:
颤振:
sdk:颤振
下拉列表\表单字段:^0.1.0
摄像机:^0.5.2+1

FlatterToast:^3.1.0根本问题是flatterToAsPlugin.java中的android.support.v4.Content.ContextCompat导入无法解析符号ContextCompat。这是一个依赖性问题

解决方案是转到Flatter项目的pubspec.yaml,找到FlatterToast依赖项并将其更新为最新版本(当前为^3.1.0)

依赖项:
颤振:
sdk:颤振
下拉列表\表单字段:^0.1.0
摄像机:^0.5.2+1

对我来说,^3.1.0我所做的就是跑步

flutter clean

然后重新运行这个项目,一切正常。

在我的情况下,我所做的就是运行

flutter clean

然后重新运行这个项目,一切正常。

在我的例子中。我在
pubspec.yaml
中更新了所有依赖项,并且它工作正常。

。我更新了pubspec.yaml中的所有依赖项,它运行正常。

对我来说是颤振声:^2.0.4对我来说是颤振声:^2.0.4