A problem occurred configuring root project ‘android’ Flutter
Limited Time Offer!
For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!
Error
FAILURE: Build failed with an exception. * What went wrong: A problem occurred configuring project ‘:app’. > Could not open cp_proj generic class cache for build file ‘C:\Users\dharm\AndroidStudioProjects\my_hospital_now\android\app\build.gradle’ (C:\Users\dharm.gradle\caches\7.4.2\scripts\dzntni8anetfv173rjlkkjzu3).
Solution
Whether the first time or not. When you click run on your application you get an X gradle build error If you have any of the following lines in your error even a single line then try this solution
Go this location:- .flutter/packages/flutter_tools/gradle/flutter.gradle
- Backup the file in another place before making edits to it
- Search for something called buildscript;
- It should come up like that (or similar, don’t worry you have a backup file)
And overwrite this code
With this
Still, your problem is not solved? If it was solved DON’T try the next one if not then try it. (And even if this didn’t work then put the backup file in its place and see if it’s working)
Then in your android folder go to build.gradle (in your project files go to android/build.gradle) and change the buildscript to this (Don’t worry about the code not being 100% like this. Just add the specified line in the shown location and that’s it)