【发布时间】:2020-06-29 13:31:25
【问题描述】:
我在使用shared preferences 并运行应用程序时遇到了一个非常奇怪的问题,我收到以下错误:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':shared_preferences:extractDebugAnnotations'.
> Could not resolve all files for configuration ':shared_preferences:lintClassPath'.
> Could not find kotlin-compiler.jar (com.android.tools.external.com-intellij:kotlin-compiler:26.5.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/external/com-intellij/kotlin-compiler/26.5.0/kotlin-compiler-26.5.0.jar
* 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 5s
Finished with error: Gradle task assembleDebug failed with exit code 1
我尝试了以下方法:
- 将 Flutter SDK/kotlin 更新到最新版本
- 命令:Flutter Doctor(查看是否有错误但一切正常)
- 更改 IDE(Visual Code 和 Intellij)
无需修改代码即可创建新的flutter项目..项目运行正常
我在 pubspec.yaml 中添加了http 包并点击了包获取,同样没有修改代码.. 项目运行没有问题
然后我添加了shared preferencespubspec.yaml 并点击package get... 然后点击run 出现错误。
我通过获取不同版本的shared preferences 重复了上一步,并且每次都遇到相同的错误。
我尝试了stackoverflow上提供的所有解决方案,都没有用。
有什么帮助吗?
【问题讨论】:
-
您可以尝试从终端运行“flutter clean”并重试吗?
-
@Arno 很遗憾没有工作...同样的错误
标签: android flutter kotlin package sharedpreferences