Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android Build a Self-Destructing Message Android App Adding Users Using Parse.com Creating an Account and App on Parse.com

James Brooks
James Brooks
3,863 Points

"Content is not allowed in prolog." error in Android Studio

After adding the Parse-1.8.1.jar files to my libs and the dependencies recommended by parse.com, I keep getting a gradle build message that says "Content is not allowed in prolog." I've noticed another person posting about an error message like this, but his seemed to be connected to a drawable resource and he solved it by unencrypting the files using Explorer. I've checked and the library files are not encrypted.

Here's a screen shot of my code and the error: http://imgur.com/2o7Cl0v

3 Answers

Harry James
Harry James
14,780 Points

It must be something to do with the way you've added it.

I added the Android SDK Parse file to Android Studio yesterday when testing this and got no errors doing so...

I did so simply by doing the last step I showed on the above method (Using Add as library).

Try removing all compile statements relating to Parse, running a Gradle sync and then repeat this last method and see if it makes any difference.

Best of luck! :)

Harry James
Harry James
14,780 Points

Hey James!

I've never come across this error and with a Google search, it looks quite complicated. I don't know what is causing this but, there's a few things I'd like to try :)


First, in your dependencies, you seem to be compiling anything ending with .jar in the libs folder and then later on, you are compiling a .jar file (Parse) again. Perhaps there is a conflict that you are compiling twice? Try removing one of the compile statements.


If that didn't fix it, undo that change and try deleting the other compile statement.


If that also did not fix it, try specifically declaring the Parse file, rather than using an asterisk. So, use this line instead of the other two compile lines:

compile files('libs/Parse-1.8.1.jar')

Also, make sure you have added the file for use in Android Studio!

Right-click on Parse-1.8.1.jar in the libs directory and click Add as library. Add it to the app module.


Let me know how it goes!

James Brooks
James Brooks
3,863 Points

Thanks for helping so quickly Harry. I've tried each of the proposed solutions, one at a time and I'm still getting the same error. At this point, I've changed the code back to what you saw in my picture above. I've noticed something else now that I imagine is related to the gradle build error. Everywhere in my code, whenever I use "R." as part of an ID, it's red and the error says that it 'cannot resolve symbol'. I wonder if there's something wrong within the original parse-1.8.1.jar file or if I somehow added it to Android Studio the wrong way. I'll look into it more tomorrow.

Harry James
Harry James
14,780 Points

Comment moved to Answer

James Brooks
James Brooks
3,863 Points

Thank you so much for helping out Harry James. Your final solution worked. I removed all of the compile statements relating to Parse. Then, I deleted the Parse jar file from libs (and selected 'safe delete'). Once that was done, I dragged the Parse 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.

Thank you so much for helping.

Harry James
Harry James
14,780 Points

Woohoo! Glad it worked eventually! :)

I've moved my comment to an Answer in case you would like to mark it as the Best Answer.