I recently changed my flutter project folder into a new one which will be used for production but after recopying everything back into the the new one i keep gettting this error

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

I have followed other way to to resolve eg like what someone said here in stack-overflow. i have also deleted the gradle from cache restarted my app still showing this error

Some of the build.gradle files can be found here github. Please how do i fix this, Thanks. Also if you need more explanation or code tell me


Solution 1: Csisanyi

A useful answer from this post Error:Unexpected lock protocol found in lock file. Expected 3, found 0

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