Reputation: 3273
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.
Upvotes: 73
Views: 75738
Reputation: 1
Step 1: close android studio
Step 2: Delete workspace.xml in idea folder
Step 3 :Run Android Studio again. I followed above steps it works for me , hope it will works for you.
Upvotes: 0
Reputation: 209
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.
Upvotes: 1
Reputation: 4130
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.
Upvotes: 1
Reputation: 1000
I am using Android Studio 4.0 I solved this by:
Deleting .idea
folder in the Project
Restart Android Studio
Done :)
Upvotes: 4
Reputation: 348
Sorry for delay response, I also came across this scenario, so tried to resolve it using many way available on internet which include
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.
Upvotes: 1
Reputation: 801
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.
Upvotes: 1
Reputation: 71
Just delete .idea folder from project directory an re run android studio. it worked for me.
Upvotes: 7
Reputation: 1373
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.
Upvotes: 7
Reputation: 1981
I have encountered similar problem many times, and there just one thing that can be done to solve this.
Just delete idea folder.
Upvotes: 9
Reputation: 11
I tried many options but finally for windows 10, File > Invalidate Caches/Restart worked for me.
Upvotes: 1
Reputation: 31
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.
Upvotes: 1
Reputation: 11
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.
Upvotes: 1
Reputation: 2300
Step 1 :Exit Android Studio.
Step 2 :Delete workspace.xml
file found in the \ProjectName\.idea\
directory.
Step 3 :Run Android Studio again.
Upvotes: 49
Reputation: 691
I just deleted the workspace.xml after closing the studio and started again. It works fine.
Upvotes: 2
Reputation: 129
on a windows 8.1, I found File > Invalidate Caches/Restart did the trick
Upvotes: 12
Reputation: 1813
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.
Upvotes: 3
Reputation: 1468
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.
Upvotes: 6
Reputation: 7258
On a Mac, I found File > Invalidate Caches/Restart did the trick.
Upvotes: 16
Reputation: 3273
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! :)
Upvotes: 79