'How to solve 'problem occurred configuring project ':flutter_plugin_android_lifecycle'.'?

I was running my flutter application, when suddenly my computer shut down due to low battery. When restarted and wanted to run the program, I encountered this problem:

A problem occurred configuring project ':flutter_plugin_android_lifecycle'.
> Could not load compiled classes for build file 'C:\flutter\.pub-cache\hosted\pub.dartlang.org\flutter_plugin_android_lifecycle-2.0.5\android\build.gradle' from cache.

I try to delete gradle/cache/7.4 but its not working. anyone know how to fix this, or why this is happening?

Edit: After i do some research, i find that this was caused by image_picker plugin in my dependency. But still don't know how to fix this



Solution 1:[1]

The cache is usually at the following locations.

On Windows: %USERPROFILE%\.gradle\caches

On Mac / UNIX: ~/.gradle/caches/

Removing the whole .gralde folder is safe, Unless you have some global properties which are gradle.properties file then it's a good idea to keep it.

You can try as well to clean build cache, with the following command gradlew cleanBuildCache.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 George