元素类型“应用程序”必须由匹配的结束标记“ application>”终止
问题描述:
这个清单有什么问题? 我使用的Android工作室2.3 **错误:异常而解析所述供给清单文件C:\用户\ HP \ AndroidStudioProjects \ Two_Screens \应用\ SRC \主\的AndroidManifest.xml元素类型“应用程序”必须由匹配的结束标记“</ application>”终止
The element type "application" must be terminated by the matching end-tag "".**
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.hp.two_screens">
<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="com.example.hp.two_screens.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.example.hp.two_screens.SecondActivity" />
</activity>
</application>
答
SecondActivity标记已关闭(以/>结尾),因此您的格式清单XML文件格式不正确,因为标记为</activity>
。删除该标签来解决问题。
<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="com.example.hp.two_screens.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.example.hp.two_screens.SecondActivity" />
//</activity> remove this closure!!
</application>
+0
谢谢@Alex Ta – Auodumber
第二个''元素的开标签是自闭的。也就是说,或者从结尾删除'/',或者删除下一行的' '。 –