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

When I upgraded to Android Studio 0.6.1, I ran into a build problem with asset files. I kept getting โ€œContent not allowed in prologโ€ during the mergeDebugResources task. Since I could not find a suitable answer to this question and have since found a solution, I answered my question to help other developers who are faced with this problem.

+8
android android-studio android-gradle
source share
2 answers

It seems that recent build changes as AS 0.6.1 and AS 0.8.1 no longer ignore specialized resource directories. As a result, in order to get around the scary "Content is not allowed in the prolog", you need to transfer the font files, properties and xml files to "src / main / assets" instead of your directory of custom mapped assets. Hope this helps.

+17
source share

I solved this problem this way: first create the directory "src / main / assets / fonts" and paste the file, and then specify this code in the build.gradle file

android { sourceSets { main { assets.srcDirs = ['src/main/assets/fonts/', 'src/main/assets/fonts/'] } } } 
+1
source share

All Articles