Android studio compile error "Content is not allowed in prolog"

Solution 1:

in "res" directory I create new "database" directory

That is not supported. You cannot invent new resource directories.

Please put the files in res/raw/ (and use via getResources().openRawResource()) or assets/ (and use via getAssets().open()).

Solution 2:

I am having the same problem What I did is,

You need to clear the cache data

Go to Build(Menu)--> Clean Project

Then

Go to Build(Menu)--> Rebuild Project

Then Run Your project

This may also help in refreshing data of android preview

Solution 3:

In my case, I had accidentally entered a random character right before the beginning of my strings.xml file.

enter image description here

I removed the "f" character before the xml declaration and all was well again.

Solution 4:

You might want to clean caches

C:\Users\<username>\.gradle\caches