我正在开发一个项目,我需要在其中实施Google登录。

我按照this教程进行操作,现在出现以下错误:

我试过了:

我尝试在build-info.xml文件中查找,它为空白,并且还有一个tempbuild-info.xml文件,其中包含一些xml代码。

我试图将这些代码从临时文件中放到原始文件中,但这也不起作用。我认为这是gradle文件中的问题,但是gradle文件同步完全正常。

我现在很确定问题出在XML文件中,因为当我切换到设计视图时,包含googleSignInButton代码的xml文件没有预览。

我的所有XML文件都是这种情况,尽管自从实施Google登录以来我什至都没有碰过它们。

任何帮助将不胜感激!
先感谢您


  错误:序言中不允许包含内容。\





  错误:任务':app:buildInfoDebugLoader'的执行失败。
  加载build-info.xml时发生异常:org.xml.sax.SAXParseException; lineNumber:1; columnNumber:1;序言中不能有内容。
      在com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:257)
      在com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:339)
      在com.android.utils.XmlUtils.parseUtfXmlFile(XmlUtils.java:514)
      在com.android.build.gradle.internal.incremental.InstantRunBuildContext.loadFromXmlFile(InstantRunBuildContext.java:626)
      在com.android.build.gradle.internal.incremental.BuildInfoLoaderTask.executeAction(BuildInfoLoaderTask.java:60)
      在sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)处
      在sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      在sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      在java.lang.reflect.Method.invoke(Method.java:498)
      在org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
      在org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore $ StandardTaskAction.doExecute(DefaultTaskClassInfoStore.java:141)
      在org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore $ StandardTaskAction.execute(DefaultTaskClassInfoStore.java:134)
      在org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore $ StandardTaskAction.execute(DefaultTaskClassInfoStore.java:123)
      在org.gradle.api.internal.AbstractTask $ TaskActionWrapper.execute(AbstractTask.java:632)
      在org.gradle.api.internal.AbstractTask $ TaskActionWrapper.execute(AbstractTask.java:615)
      在org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:95)处
      在org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:76)
      在org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:55)
      在org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:62)
      在org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
      在org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:88)
      在org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:46)处
      在org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:51)
      在org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
      在org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
      在org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
      在org.gradle.execution.taskgraph.DefaultTaskGraphExecuter $ EventFiringTaskWorker $ 1.execute(DefaultTaskGraphExecuter.java:236)
      在org.gradle.execution.taskgraph.DefaultTaskGraphExecuter $ EventFiringTaskWorker $ 1.execute(DefaultTaskGraphExecuter.java:228)
      在org.gradle.internal.Transformers $ 4.transform(Transformers.java:169)
      在org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:106)
      在org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:61)
      在org.gradle.execution.taskgraph.DefaultTaskGraphExecuter $ EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:228)处
      在org.gradle.execution.taskgraph.DefaultTaskGraphExecuter $ EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:215)处
      在org.gradle.execution.taskgraph.Abs​​tractTaskPlanExecutor $ TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:77)
      在org.gradle.execution.taskgraph.Abs​​tractTaskPlanExecutor $ TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:58)
      在org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:32)
      在org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:113)
      在org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37)
      在org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
      在org.gradle.execution.DefaultBuildExecuter.access $ 000(DefaultBuildExecuter.java:23)
      在org.gradle.execution.DefaultBuildExecuter $ 1.proceed(DefaultBuildExecuter.java:43)
      在org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
      在org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
      在org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:30)
      在org.gradle.initialization.DefaultGradleLauncher $ 3.execute(DefaultGradleLauncher.java:196)
      在org.gradle.initialization.DefaultGradleLauncher $ 3.execute(DefaultGradleLauncher.java:193)
      在org.gradle.internal.Transformers $ 4.transform(Transformers.java:169)
      在org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:106)
      在org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:56)
      在org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:193)
      在org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:119)
      在org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:102)
      在org.gradle.launcher.exec.GradleBuildController.run(GradleBuildController.java:71)
      在org.gradle.tooling.internal.provider.runner.BuildModelActionRunner.run(BuildModelActionRunner.java:50)
      在org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
      在org.gradle.tooling.internal.provider.runner.RunAsBuildOperationBuildActionRunner $ 1.execute(RunAsBuildOperationBuildActionRunner.java:43)
      在org.gradle.tooling.internal.provider.runner.RunAsBuildOperationBuildActionRunner $ 1.execute(RunAsBuildOperationBuildActionRunner.java:40)
      在org.gradle.internal.Transformers $ 4.transform(Transformers.java:169)
      在org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:106)
      在org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:56)
      在org.gradle.tooling.internal.provider.runner.RunAsBuildOperationBuildActionRunner.run(RunAsBuildOperationBuildActionRunner.java:40)
      在org.gradle.tooling.internal.provider.runner.SubscribableBuildActionRunner.run(SubscribableBuildActionRunner.java:75)
      在org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
      在org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:41)
      在org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26)
      在org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:75)
      在org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:49)
      在org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:44)
      在org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:29)
      在org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:67)
      在org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
      在org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
      在org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:47)
      在org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
      在org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
      在org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
      在org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
      在org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
      在org.gradle.launcher.daemon.server.exec.ForwardClientInput $ 2.call(ForwardClientInput.java:74)
      在org.gradle.launcher.daemon.server.exec.ForwardClientInput $ 2.call(ForwardClientInput.java:72)
      在org.gradle.util.Swapper.swap(Swapper.java:38)
      在org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
      在org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
      在org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55)
      在org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
      在org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:60)
      在org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
      在org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
      在org.gradle.launcher.daemon.server.exec.FoundBuildEnvironment.doBuild(BuildBuildEnvironment.java:72)处
      在org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
      在org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
      在org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy $ 1.run(StartBuildOrRespondWithBusy.java:50)
      在org.gradle.launcher.daemon.server.DaemonStateCoordinator $ 1.run(DaemonStateCoordinator.java:297)
      在org.gradle.internal.concurrent.ExecutorPolicy $ CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
      在org.gradle.internal.concurrent.StoppableExecutorImpl $ 1.run(StoppableExecutorImpl.java:40)
      在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      在java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:617)
      在java.lang.Thread.run(Thread.java:745)

最佳答案

尝试这个

重新启动PC时,我遇到了同样的错误。

解决方案只需清理项目并再次运行

这解决了我的问题。

09-07 14:38