ponnamkarthik/toast/fluttertoast/MethodCallHandlerImpl.kt 编译颤振时

当我编译我的颤振项目时,它显示:

To see a detailed report, use the --untranslated-messages-file 
option in the tool to generate a JSON format file containing 
all messages that need to be translated.
Launching lib/main.dart on sdk gphone x86 arm in debug mode...
Running Gradle task 'assembleDebug'...
e: /home/dolphin/apps/flutter/.pub-cache/hosted/pub.dartlang.org/fluttertoast-7.1.5/android/src/main/kotlin/io/github/ponnamkarthik/toast/fluttertoast/MethodCallHandlerImpl.kt: (16, 16): Redeclaration: MethodCallHandlerImpl
e: /home/dolphin/apps/flutter/.pub-cache/hosted/pub.dartlang.org/fluttertoast-7.1.6/android/src/main/kotlin/io/github/ponnamkarthik/toast/fluttertoast/MethodCallHandlerImpl.kt: (17, 16): Redeclaration: MethodCallHandlerImpl

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':fluttertoast:compileDebugKotlin'.
> Compilation error. See log for more 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 7s
Exception: Gradle task assembleDebug failed with exit code 1

它现在工作正常,然后我尝试升级 fluttertoast

  fluttertoast: ^7.1.6

但仍然无法正常工作,我该怎么做才能解决它?

stack overflow ponnamkarthik/toast/fluttertoast/MethodCallHandlerImpl.kt when compile flutter
原文答案
author avatar

接受的答案

将其更改为 fluttertoast:7.1.5 运行 Pub 获取并运行您的项目之后,您可以更改为 fluttertoast:^7.1.6 显然这不是修复此错误的最佳方法,但它对我有用。祝你好运


答案:

作者头像

尝试执行以下命令:

flutter clean
flutter pub get