Android studio compile error “Content is not allowed in prolog”

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()).

I am having the same problem What I did is,

You need to clear the cache data

Go to Build(Menu)–> Clean Project


Go to Build(Menu)–> Rebuild Project

Then Run Your project

This may also help in refreshing data of android preview

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.

Leave a Comment