任务':fluttertoast:compileDebugKotlin'执行失败
- 我试过
flutter clean flutter pub cache repair,- 更改 fluttertoast 包的版本和版本,并删除它,
- 删除android/.gradle目录并重新构建。
没有任何效果。
Launching libmain.dart on Redmi Note 4 in debug mode...
libmain.dart:1
Parameter format not correct -
e: C:srcflutter.pub-cachehostedpub.dartlang.orgfluttertoast-7.1.8androidsrcmainkotliniogithubponnamkarthiktoastfluttertoastMethodCallHandlerImpl.kt: (45, 84): Unresolved reference: R
e: C:srcflutter.pub-cachehostedpub.dartlang.orgfluttertoast-7.1.8androidsrcmainkotliniogithubponnamkarthiktoastfluttertoastMethodCallHandlerImpl.kt: (70, 68): Unresolved reference: R
e: C:srcflutter.pub-cachehostedpub.dartlang.orgfluttertoast-7.1.8androidsrcmainkotliniogithubponnamkarthiktoastfluttertoastMethodCallHandlerImpl.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)
回答
更新compileSdkVersion到30我的app/build.gradle解决了这个问题,让我保持最新gradle这个。
旧答案:
我不知道为什么,但我能够通过回滚到
classpath 'com.android.tools.build:gradle:3.5.4'
在我的顶级水平build.gradle。
THE END
二维码