Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Android Implementing Designs for Android Adding Push Notifications from Parse.com Setting Up Push Notifications

Chris Wolchesky
Chris Wolchesky
12,025 Points

Gradle build errors in Android Studio: Content is not allowed in prolog

I imported the latest version of the Parse library for setting up Push Notifications today and I'm getting a new Gradle build error after doing so. I've done some initial searches and from what I'm gathering, this can be caused from invalid XML files, which is all well and fine, but it's indicating one of the drawable (PNG) resources is causing the issue. I've tried to just remove the drawable from the project just to see if it'd move on, but the next resource triggers the same error ad-infinum. Any insight where to look for resolution would be appreciated!

Chris Wolchesky
Chris Wolchesky
12,025 Points

I got a stack trace of the error from Gradle. I'm not sure of what I'm reading here, truth be told. Also, to provide more information: I've attempted to restore the previous Parse library (1.6.0) and still get the same error, I've done a clean rebuild, and I've also Invalidated the Cache in Android Studio and restarted, still seeing the same error!

18:51:11.242 [ERROR] [org.gradle.BuildExceptionReporter] 18:51:11.243 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception. 18:51:11.243 [ERROR] [org.gradle.BuildExceptionReporter] 18:51:11.243 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong: 18:51:11.244 [ERROR] [org.gradle.BuildExceptionReporter] Execution failed for task ':app:mergeDebugResources'. 18:51:11.244 [ERROR] [org.gradle.BuildExceptionReporter] > D:\Projects\Android\ThisMessageWillSelfDestruct\app\src\main\res\drawable_xxxhdpi\avatar_empty.png:0:0: Error: Content is not allowed in prolog. 18:51:11.245 [ERROR] [org.gradle.BuildExceptionReporter] 18:51:11.245 [ERROR] [org.gradle.BuildExceptionReporter] * Exception is: 18:51:11.247 [ERROR] [org.gradle.BuildExceptionReporter] org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:mergeDebugResources'. 18:51:11.247 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69) 18:51:11.247 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46) 18:51:11.248 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35) 18:51:11.248 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64) 18:51:11.248 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58) 18:51:11.250 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:42) 18:51:11.250 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52) 18:51:11.250 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53) 18:51:11.251 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43) 18:51:11.251 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:289) 18:51:11.251 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.executeTask(AbstractTaskPlanExecutor.java:79) 18:51:11.252 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:63) 18:51:11.252 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:51) 18:51:11.253 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:23) 18:51:11.254 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:86) 18:51:11.255 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:29) 18:51:11.255 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61) 18:51:11.255 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23) 18:51:11.256 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:67) 18:51:11.256 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32) 18:51:11.257 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61) 18:51:11.257 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:54) 18:51:11.257 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:166) 18:51:11.258 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:113) 18:51:11.258 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:81) 18:51:11.258 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:64) 18:51:11.259 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.tooling.internal.provider.BuildModelAction.run(BuildModelAction.java:76) 18:51:11.259 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.tooling.internal.provider.BuildModelAction.run(BuildModelAction.java:31) 18:51:11.259 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.tooling.internal.provider.ConfiguringBuildAction.run(ConfiguringBuildAction.java:150) 18:51:11.260 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:35) 18:51:11.260 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:45) 18:51:11.261 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34) 18:51:11.261 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125) 18:51:11.261 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:42) 18:51:11.262 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125) 18:51:11.262 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:24) 18:51:11.262 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125) 18:51:11.263 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.daemon.server.exec.StartStopIfBuildAndStop.execute(StartStopIfBuildAndStop.java:33) 18:51:11.263 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125) 18:51:11.263 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.daemon.server.exec.ReturnResult.execute(ReturnResult.java:34) 18:51:11.264 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125) 18:51:11.264 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:71) 18:51:11.264 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:69) 18:51:11.265 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.util.Swapper.swap(Swapper.java:38) 18:51:11.265 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:69) 18:51:11.265 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125) 18:51:11.266 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:60) 18:51:11.266 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34) 18:51:11.267 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125) 18:51:11.268 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:60) 18:51:11.268 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34) 18:51:11.268 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125) 18:51:11.269 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:45) 18:51:11.272 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.daemon.server.DaemonStateCoordinator.runCommand(DaemonStateCoordinator.java:186) 18:51:11.272 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy.doBuild(StartBuildOrRespondWithBusy.java:49) 18:51:11.272 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34) 18:51:11.273 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125) 18:51:11.276 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.daemon.server.exec.HandleStop.execute(HandleStop.java:36) 18:51:11.277 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125) 18:51:11.277 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.daemon.server.exec.DaemonHygieneAction.execute(DaemonHygieneAction.java:39) 18:51:11.277 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125) 18:51:11.278 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.daemon.server.exec.CatchAndForwardDaemonFailure.execute(CatchAndForwardDaemonFailure.java:32) 18:51:11.281 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125) 18:51:11.281 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.daemon.server.exec.DefaultDaemonCommandExecuter.executeCommand(DefaultDaemonCommandExecuter.java:51) 18:51:11.281 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.daemon.server.DefaultIncomingConnectionHandler$ConnectionWorker.handleCommand(DefaultIncomingConnectionHandler.java:155) 18:51:11.282 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.daemon.server.DefaultIncomingConnectionHandler$ConnectionWorker.receiveAndHandleCommand(DefaultIncomingConnectionHandler.java:128) 18:51:11.282 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.daemon.server.DefaultIncomingConnectionHandler$ConnectionWorker.run(DefaultIncomingConnectionHandler.java:116) 18:51:11.285 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:64) 18:51:11.285 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: com.android.build.gradle.tasks.ResourceException: D:\Projects\Android\ThisMessageWillSelfDestruct\app\src\main\res\drawable_xxxhdpi\avatar_empty.png:0:0: Error: Content is not allowed in prolog. 18:51:11.285 [ERROR] [org.gradle.BuildExceptionReporter] at com.android.build.gradle.tasks.MergeResources.doFullTaskAction(MergeResources.groovy:99) 18:51:11.286 [ERROR] [org.gradle.BuildExceptionReporter] at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.groovy:70) 18:51:11.286 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:63) 18:51:11.289 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.doExecute(AnnotationProcessingTaskFactory.java:236) 18:51:11.290 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:212) 18:51:11.290 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.execute(AnnotationProcessingTaskFactory.java:223) 18:51:11.290 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:201) 18:51:11.294 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:533) 18:51:11.294 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:516) 18:51:11.294 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80) 18:51:11.295 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61) 18:51:11.295 [ERROR] [org.gradle.BuildExceptionReporter] ... 67 more 18:51:11.298 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: D:\Projects\Android\ThisMessageWillSelfDestruct\app\src\main\res\drawable_xxxhdpi\avatar_empty.png:0:0: Error: Content is not allowed in prolog. 18:51:11.299 [ERROR] [org.gradle.BuildExceptionReporter] at com.android.ide.common.res2.ValueResourceParser2.parseDocument(ValueResourceParser2.java:205) 18:51:11.299 [ERROR] [org.gradle.BuildExceptionReporter] at com.android.ide.common.res2.ValueResourceParser2.parseFile(ValueResourceParser2.java:77) 18:51:11.299 [ERROR] [org.gradle.BuildExceptionReporter] at com.android.ide.common.res2.ResourceSet.createResourceFile(ResourceSet.java:278) 18:51:11.302 [ERROR] [org.gradle.BuildExceptionReporter] at com.android.ide.common.res2.ResourceSet.parseFolder(ResourceSet.java:253) 18:51:11.302 [ERROR] [org.gradle.BuildExceptionReporter] at com.android.ide.common.res2.ResourceSet.readSourceFolder(ResourceSet.java:136) 18:51:11.303 [ERROR] [org.gradle.BuildExceptionReporter] at com.android.ide.common.res2.DataSet.loadFromFiles(DataSet.java:232) 18:51:11.303 [ERROR] [org.gradle.BuildExceptionReporter] at com.android.ide.common.res2.ResourceSet.loadFromFiles(ResourceSet.java:48) 18:51:11.303 [ERROR] [org.gradle.BuildExceptionReporter] at com.android.build.gradle.tasks.MergeResources.doFullTaskAction(MergeResources.groovy:83) 18:51:11.307 [ERROR] [org.gradle.BuildExceptionReporter] ... 77 more 18:51:11.307 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog. 18:51:11.307 [ERROR] [org.gradle.BuildExceptionReporter] at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:257) 18:51:11.308 [ERROR] [org.gradle.BuildExceptionReporter] at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:347) 18:51:11.308 [ERROR] [org.gradle.BuildExceptionReporter] at com.android.utils.XmlUtils.parseUtfXmlFile(XmlUtils.java:454) 18:51:11.311 [ERROR] [org.gradle.BuildExceptionReporter] at com.android.ide.common.res2.ValueResourceParser2.parseDocument(ValueResourceParser2.java:202) 18:51:11.312 [ERROR] [org.gradle.BuildExceptionReporter] ... 84 more 18:51:11.312 [ERROR] [org.gradle.BuildExceptionReporter]

1 Answer

Chris Wolchesky
Chris Wolchesky
12,025 Points

Found the answer. I only found the solution after looking at the files in Explorer instead of Android Studio. Windows had encrypted the files for some reason or another. Once I turned off file encryption they were able to be included and the build completed fine.