Fix Android Studio Corrupted Project Workspace Settings
Android StudioAndroid Studio Problem Overview
I had this problem for a while and was able to solve it myself.
If in opening your project in Android Studio and something similar to this error message pops up:
Cannot load settings from file (C:\Users\User\AndroidStudioProjects\ProjectName\.idea\workspace.xml): Error on line 1: Content is not allowed in prolog. Please correct the file content.
Android Studio Solutions
Solution 1 - Android Studio
It probably means your project workspace settings file is corrupted by whatever reason and Android Studio could not read it. Mine is probably because of BSOD, because Windows.
To solve the error, just delete the workspace.xml as specified in the error message. It is ok to delete it since you probably already lost all your custom workspace settings when the file got corrupted and you will never be able to save new workspace settings unless you fix the corrupted file. After deleting it, the next time you open your project in Android Studio, it will try to look for the workspace file, and if it can't find it, it will just create a new valid one.
I hope this helps! :)
Solution 2 - Android Studio
Step 1 :Exit Android Studio.
Step 2 :Delete workspace.xml
file found in the \ProjectName\.idea\
directory.
Step 3 :Run Android Studio again.
Solution 3 - Android Studio
On a Mac, I found File > Invalidate Caches/Restart did the trick.
Solution 4 - Android Studio
on a windows 8.1, I found File > Invalidate Caches/Restart did the trick
Solution 5 - Android Studio
I have encountered similar problem many times, and there just one thing that can be done to solve this.
Just delete idea folder.
Solution 6 - Android Studio
I would like to suggest restart Android studio File > invalidate caches and restart... > invalidate caches and restart option before deleting workspace.xml
if restarting android studio fail to solve your problem, kindly run check disk from disk properties because I notice that this error is raise due to file indexing / file system error or sometime permission denied by OS.
Just Delete idea folder ..
Thank you.
Solution 7 - Android Studio
in Terminal navigate to your project directory, and run these
rm -rf .idea
rm *.iml
then go into your app directory and do that same thing as above.
Finally, "File" -> "New" -> "Import", this should solve the corruption.
Solution 8 - Android Studio
Just delete .idea folder from project directory an re run android studio. it worked for me.
Solution 9 - Android Studio
I am using Android Studio 4.0 I solved this by:
-
Deleting
.idea
folder in the Project -
Restart Android Studio
Done :)
Solution 10 - Android Studio
I have encountered similar problem many times, and there just one thing that can be done to solve this.
step 1 : delete the .xml files containing error, or cut and paste to some backup folder if you want to inspect that file later on. However, it's unlikely that you'd find anything.
step 2 : try to open android studio after having deleted those files, it must be running perfect. if it doesn't and still contains errors try 'invalidate catches and restart' option in file menu.
Solution 11 - Android Studio
I just deleted the workspace.xml after closing the studio and started again. It works fine.
Solution 12 - Android Studio
Since for me didn't worked to delete the file i just override the actual workspace.xml
with the one i had on backup directory of my project. Now it works.
Solution 13 - Android Studio
Had Today the same Problem, but i found a "workspace.xml" with something like "jpt_tmp" at his end, in the same directory. After swaping the "tmp" once with the original, i got everything back to work.
Solution 14 - Android Studio
I tried many options but finally for windows 10, File > Invalidate Caches/Restart worked for me.
Solution 15 - Android Studio
I guess the problems depends on each situation. I was using Flutter in Android Studio and suddenly one day this problem occurred.
Just delete the project_name.iml
in Flutter project and project_name_android.iml
in android module.
For android projects simply delete .iml
file in the project.
After deleting restart Android Studio and follow the steps as in this video. It was of great help.
Solution 16 - Android Studio
Sorry for delay response, I also came across this scenario, so tried to resolve it using many way available on internet which include
- invalidate cache and restart
- restart android studio
- deleting *.iml file
- restart system
The only solution worked for me is, I export my project into zip format and then I open it from there. The project open and build successfully without any problem.
I hope this will help for you.
Solution 17 - Android Studio
In my case it was iml file which was corrupted, so i deleted it, restarted android studio, pasted the same file as it was before, restarted android studio and everything was working fine.
Solution 18 - Android Studio
A gradle sync did the trick for me.
Just press the button from the toolbar named "sync project with gradle files". The icon is an elephant with a little blue arrow.
If it still does not work, try deleting the .idea folder first, before syncing the gradle files again.