【问题标题】:Execution failed for task ':fluttertoast:compileDebugKotlin' [closed]任务':fluttertoast:compileDebugKotlin'执行失败[关闭]
【发布时间】:2021-05-22 08:10:13
【问题描述】:
  1. 我试过flutter clean
  2. flutter pub cache repair,
  3. fluttertoast 包的更改和版本,以及删除它,
  4. 删除android/.gradle目录并重新构建。

没有任何效果。

Launching lib\main.dart on Redmi Note 4 in debug mode...
lib\main.dart:1
Parameter format not correct -
e: C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\fluttertoast-7.1.8\android\src\main\kotlin\io\github\ponnamkarthik\toast\fluttertoast\MethodCallHandlerImpl.kt: (45, 84): Unresolved reference: R
e: C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\fluttertoast-7.1.8\android\src\main\kotlin\io\github\ponnamkarthik\toast\fluttertoast\MethodCallHandlerImpl.kt: (70, 68): Unresolved reference: R
e: C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\fluttertoast-7.1.8\android\src\main\kotlin\io\github\ponnamkarthik\toast\fluttertoast\MethodCallHandlerImpl.kt: (85, 64): Unresolved reference: R
2

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 39s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)

【问题讨论】:

  • 能否提供您的 MethodCallHandlerImpl 代码?
  • 尝试以前的版本 7.1.6
  • 我遇到了同样的错误。我尝试回滚到 7.1.6,使缓存无效,颤抖干净......没有解决问题。我知道我在 Android Studio 中安装了与 Android 相关的更新。也许与此有关?

标签: android flutter kotlin gradle


【解决方案1】:

将我的app/build.gradle 中的compileSdkVersion 更新为30 解决了这个问题,让我可以保持最新的gradle。

旧答案:

我不知道为什么,但我能够通过回滚来解决问题

classpath 'com.android.tools.build:gradle:3.5.4'

在我的顶级build.gradle

【讨论】:

  • Gradle 什么?摇篮文件?摇篮文件夹?摇篮配置?摇篮安装?还有什么?请通过答案做出回应,而不是在 cmets 中(without "Edit:"、"Update:" 或类似的 - 答案应该看起来好像是今天写的)。
  • flutter clean 后工作
猜你喜欢
  • 2021-05-15
  • 1970-01-01
  • 2020-03-07
  • 2023-03-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-08-20
  • 2016-05-02
相关资源
最近更新 更多