首页 > 解决方案 > 配置根项目“android”时出现问题。在锁定文件中发现意外的锁定协议。预期 3,发现 0

问题描述

我最近将我的颤振项目文件夹更改为一个将用于生产的新文件夹,但是在将所有内容重新复制回新文件夹后,我一直收到此错误

Launching lib\main.dart on Samsung Galaxy S10 in debug mode...
Running Gradle task 'assembleDebug'...

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all dependencies for configuration ':classpath'.
   > Could not create service of type OutputFilesRepository using ExecutionGradleServices.createOutputFilesRepository().
      > Unexpected lock protocol found in lock file. Expected 3, found 0.

* 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 2m 24s
Exception: Gradle task assembleDebug failed with exit code 1

我已经按照其他方式来解决,例如有人在stack-overflow中所说的。我还从缓存中删除了 gradle 重新启动了我的应用程序仍然显示此错误

一些 build.gradle 文件可以在这里找到github。请问如何解决这个问题,谢谢。另外,如果您需要更多解释或代码,请告诉我

标签: androidflutterdartgradle

解决方案


这篇文章的一个有用答案错误:在锁定文件中发现意外的锁定协议。预期 3,发现 0

cd path/to/.gradle/
find . -name "*.lock" -delete 

推荐阅读