Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix "Content is not allowed in prolog" build error?

When I upgraded to Android Studio 0.6.1, I encountered a build issue with asset files. I kept getting "Content is not allowed in prolog" during the mergeDebugResources task. Since I couldn't find a suitable answer to this and have since found a solution, I've answered my own question to help other developers who face this issue.

like image 934
oracleicom Avatar asked Jun 30 '14 17:06

oracleicom


People also ask

What is prolog in XML?

The prolog consists of an XML declaration, possibly followed by a document type declaration. The body is made up of a single root element, possibly with some comments and/or processing instructions. An XML document is typically a computer file whose contents meet the requirements laid out in the XML specification.


2 Answers

It seems that the recent build changes since AS 0.6.1 and AS 0.8.1 no longer ignore custom asset directories. As a result, to get around the dreaded "Content is not allowed in prolog" you'll need to move your font files, properties and xml files to "src/main/assets" instead of your custom mapped assets directory. I hope this helps.

like image 178
oracleicom Avatar answered Oct 27 '22 11:10

oracleicom


I resolved this issue in this way, first create directory "src/main/assets/fonts" and paste the file then mention this code in build.gradle

android { sourceSets { main { assets.srcDirs = ['src/main/assets/fonts/', 'src/main/assets/fonts/'] } } }
like image 42
Reyaj Avatar answered Oct 27 '22 11:10

Reyaj