簡體   English   中英

根元素必須格式正確-Android清單

[英]root element must be well-formed-android manifest

**我的清單文件中的錯誤在下面列出,我認為這與並排的清單重復有關,我無法修復它**

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.BinaryRelics"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
    android:minSdkVersion="11"
    android:targetSdkVersion="20" />

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

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity
        android:name=".Arcademode"
        android:label="@string/title_activity_arcademode" >
    </activity>
    </application>

錯誤在下面的這一行上,請注意,如果我刪除第一個清單標記,則兩個清單標記如何彼此相鄰,它表示如果我刪除第二個清單標記,則應用程序必須是清單的直接子代,它將錯誤移至下一個代碼行

    </manifest><manifest xmlns:android="http://schemas.android.com/apk/res/android" >

    <application>
    <activity
        android:name="com.BinaryRelics.Arcademode"
        android:label="@string/title_activity_arcademode"
        android:parentActivityName="com.BinaryRelics.Homescreen" >
        <meta-data
            android:name="android.support.PARENT_ACTIVITY"
            android:value="com.BinaryRelics.Homescreen" />
    </activity>
    </application>

    </manifest>>>>>>>> Added

為什么要定義兩個清單和兩個應用程序? 您可能會放棄兩個應用程序(我從未嘗試過),但是您只能有一個根節點,並且它必須是“ manifest”

刪除中間的整行

</manifest><manifest xmlns:android="http://schemas.android.com/apk/res/android" >

從第二個定義的application節點中取出<activity ...> ... </activity>並將其移到第一個定義的application

然后從末尾刪除剩下的<application></application>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM