YoutubeAPI根元素之前的文档中的标记必须格式正确

时间:2017-10-04 09:41:29

标签: android youtube-api

I just spread the errors but the main error still there :( still no solution

C:\ MagicSaloons \ app \ src \ main \ res \ libs \ YouTubeAndroidPlayerApi.jar:1:2:错误:根元素前面的文档中的标记必须格式正确。 :app:mergeDebugResources FAILED

失败:构建因异常而失败。

  • 出了什么问题: 任务':app:mergeDebugResources'。

    的执行失败
      

    C:\ MagicSaloons \ app \ src \ main \ res \ libs \ YouTubeAndroidPlayerApi.jar:1:2:错误:根元素前面的文档中的标记必须格式正确。

  • 尝试: 使用--info或--debug选项运行以获得更多日志输出。

  • 例外情况是: org.gradle.api.tasks.TaskExecutionException:任务':app:mergeDebugResources'执行失败。 在org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:84) 在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) at 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) at 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) at org.gradle.execution.taskgraph.Abs​​tractTaskPlanExecutor $ TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:77) at 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) at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:41) at 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.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.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) at org.gradle.internal.concurrent.ExecutorPolicy $ CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54) at org.gradle.internal.concurrent.StoppableExecutorImpl $ 1.run(StoppableExecutorImpl.java:40) 引起:com.android.build.gradle.tasks.ResourceException:C:\ MagicSaloons \ app \ src \ main \ res \ libs \ YouTubeAndroidPlayerApi.jar:1:2:错误:根元素前面的文档中的标记必须形式良好。 在com.android.build.gradle.tasks.MergeResources.doFullTask​​Action(MergeResources.java:166) 在com.android.build.gradle.internal.tasks.IncrementalTask​​.taskAction(IncrementalTask​​.java:88) 在org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73) at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore $ IncrementalTask​​Action.doExecute(DefaultTaskClassInfoStore.java:163) 在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.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:95) 在org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:76) ......还有78个 引起:C:\ MagicSaloons \ app \ src \ main \ res \ libs \ YouTubeAndroidPlayerApi.jar:1:2:错误:根元素之前的文档中的标记必须格式正确。 在com.android.ide.common.res2.MergingException.throwIfNonEmpty(MergingException.java:152) 在com.android.ide.common.res2.DataSet.loadFromFiles(DataSet.java:257) 在com.android.ide.common.res2.ResourceSet.loadFromFiles(ResourceSet.java:53) 在com.android.build.gradle.tasks.MergeResources.doFullTask​​Action(MergeResources.java:136) ... 85更多

建立失败

总时间:2.443秒

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.example.danutneagu.magicsaloons">

<!-- To auto-complete the email text field in the login form with the user's emails -->
<uses-permission android:name="android.permission.GET_ACCOUNTS"/>
<uses-permission android:name="android.permission.READ_PROFILE"/>
<uses-permission android:name="android.permission.READ_CONTACTS"/>
<uses-permission android:name="android.permission.INTERNET"/>

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme">
    <activity
        android:name=".LoginActivity"
        android:label="@string/app_name"
        android:theme="@style/Theme.AppCompat">
        <intent-filter>
            <action android:name="android.intent.action.MAIN"/>

            <category android:name="android.intent.category.LAUNCHER"/>
        </intent-filter>
    </activity>
    <activity
        android:name=".MainActivity"
        android:theme="@style/Theme.AppCompat"/>
    <activity
        android:name=".SignupActivity"
        android:theme="@style/Theme.AppCompat"/>
    <activity
        android:name=".CoaforServicesList"
        android:theme="@style/Theme.AppCompat">
    </activity>
    <activity android:name=".ImageList">
    </activity>
    <activity
        android:name=".Contact"
        android:theme="@style/Theme.AppCompat">
    </activity>
    <activity android:name=".ImageList2">
    </activity>
    <activity
        android:name=".CoaforServicesList2"
        android:theme="@style/Theme.AppCompat">
    </activity>
    <activity
        android:name=".AboutUs"
        android:theme="@style/Theme.AppCompat">
    </activity>
    <activity
        android:name=".VideoViewActivity">
    </activity>
    <activity
        android:name=".Deals"
        android:theme="@style/Theme.AppCompat">
    </activity>
    <activity
        android:name=".Gallery"
        android:theme="@style/Theme.AppCompat">
    </activity>
    <activity
        android:name=".Blog"
        android:theme="@style/Theme.AppCompat">
    </activity>
    <activity
        android:name=".WorkWithUs"
        android:theme="@style/Theme.AppCompat">
    </activity>
    <activity
        android:name=".Newsletter"
        android:theme="@style/Theme.AppCompat">
    </activity>
    <activity android:name=".CoaforServicesAndProductsSearch">
    </activity>
    <activity android:name=".YoutubeActivity">
    </activity>
</application>

各位大家好,我每次想要清理/重建/构建/编译时都遇到这个问题,而且因为我是一个新的开发人员,我实际上已经陷入困境。主要问题是制作YoutubeAPI工作

我很幸运,只有一次工作没有错误,但在我尝试编译后返回到同样的错误。

真的很烦人。任何想法都受到欢迎。

谢谢!

1 个答案:

答案 0 :(得分:0)

根据此reference,请确保将"保留在文件的顶部。同样如此documentation中所述,如果元素没有正确嵌套,则此标记将是错误的。在格式良好的xml文档中,xml元素的嵌套必须正确。如果验证的xml解析器没有正确遵循DTD设置的规则,则会生成错误。