I use latest Android Studio 0.8.4 (for OS X), in "res" directory I create new "database" directory and put there all files what I need and when I try to compile I receive this error.
Error:Content is not allowed in prolog.
:app:mergeDebugResources FAILED
/Users/filipp/data/Android_dev/project/app/src/main/res/database/5clSubject0Book0.txt
Error:Error: Content is not allowed in prolog.
Error:Execution failed for task ':app:mergeDebugResources'.
> /Users/filipp/data/Android_dev/project/app/src/main/res/database/5clSubject0Book0.txt:0:0: Error: Content is not allowed in prolog.
Information:BUILD FAILED
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
Then
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.
I removed the "f" character before the xml declaration and all was well again.
You might want to clean caches
C:\Users\<username>\.gradle\caches
I faced the same error when I created assets folder inside app/src/main/res/
We shouldn't create folders anywhere at our will.
To create new folders, make sure that you go to
File -> Folder and consequently ,choose one of the folders among the options displayed.
This way the IDE creates the folder at appropriate locations and thus accessing them doesn't raise any errors.
I removed all of the compile statements. Then, I deleted the jar files from libs (and selected 'safe delete'). Once that was done, I dragged the jar file back into libs. Once there, I right clicked on libs selected to add it as a library. Now the gradle builds fine and everything works.
You can only have predefined set of folder inside res folder.
so you are creating database folder inside res folder which is invalid.
Either put database files inside assets folder or raw folder.
Old question but googling the error got me here.
This was fixed for me by deleting the (empty) "navigation" folder from res, it was left over when checking out a different branch from a repository, appears it can't be empty or it will cause this error.