【问题标题】:ERROR: Failed to parse XML in C:\Users\aNTA\AndroidStudioProjects\breaking\app\src\main\AndroidManifest.xml错误:无法解析 C:\Users\aNTA\AndroidStudioProjects\breaking\app\src\main\AndroidManifest.xml 中的 XML
【发布时间】:2020-11-26 21:05:18
【问题描述】:

我是 AppDev 的新手,正在自学。在进行实验时,我遇到了这个问题,目前很难解决。任何人都可以帮助我pjease。我正在使用 Android Studio 3.6

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

    <activity>

        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">

</activity

元素类型“activity”必须以匹配的结束标签“”结束。

任何帮助将不胜感激。

谢谢 乔什

【问题讨论】:

    标签: android android-studio android-layout android-fragments zappdev


    【解决方案1】:

    您的代码看起来很乱。如果真的是manifest文件代码,那么应该是这样的

    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.breaking">
    
    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name="activity name"/>
     </application>
    </manifest>
    

    【讨论】:

      【解决方案2】:

      如果这是整个清单文件,您将有两个活动打开和一个在末尾关闭。

      错误指向明显的解决方案。

      <?xml version="1.0" encoding="utf-8"?>
      <activity>xmlns:android="http://schemas.android.com/apk/res/android"
          package="com.example.breaking">
      
          <activity>
      
              android:allowBackup="true"
              android:icon="@mipmap/ic_launcher"
              android:label="@string/app_name"
              android:roundIcon="@mipmap/ic_launcher_round"
              android:supportsRtl="true"
              android:theme="@style/AppTheme">
           **</activity>**
      </activity
      

      【讨论】:

      • 感谢大家的帮助。非常感谢。
      • 我可以加你私聊Android Studio项目吗?
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-11-02
      • 1970-01-01
      • 1970-01-01
      • 2019-08-05
      相关资源
      最近更新 更多