简体   繁体   中英

Android Studio: New tv project inserts merge lines into AndroidManifest.xml and is not well formed

I am using the latest version of Android Studio 0.8.14.

After creating a new project for tv with android 5.0, I get a gradle error stating.

  The markup in the document proceding the root element must be well-formed
  Problem was found with the config task app:generateDebugBuildConfig

After taking a look in the androidmanifest I notice some issues. This is a brand new project. Any ideas ?

I am placing the manifest below, you can plainly see the Orginal and Added words. Seems to have been some merge issue or something ??

I tried removing the Original and the invalid markup. But that didnt seem to work. I get an error now saying

"Manifest merger failed : Main AndroidManifest.xml at AndroidManifest.xml manifest:package attribute is not declared"

Here is the original manifest, untouched.

<<<<<<< Original
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.testme.myapplication">

    <application android:allowBackup="true" android:label="@string/app_name"
        android:icon="@drawable/ic_launcher" android:theme="@style/AppTheme">

    </application>

</manifest>

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


    <uses-permission android:name="android.permission.INTERNET" />

    <uses-feature
        android:name="android.hardware.touchscreen"
        android:required="false" />

    <application
                        android:label="@string/app_name"
            android:theme="@style/Theme.Leanback"
            android:allowBackup="false">

        <activity android:name="com.testme.myapplication.MainActivity"
            android:logo="@drawable/app_icon_quantum"
            android:screenOrientation="landscape"
            android:label="@string/app_name"
            >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LEANBACK_LAUNCHER" />
            </intent-filter>
        </activity>

        <activity
            android:name="PlayerActivity"
            android:theme="@android:style/Theme.NoTitleBar.Fullscreen" />

        <activity android:name="com.testme.myapplication.DetailsActivity" />

    </application>

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

You can have just one element in your AndroidManifest.xml file.

In addition, the two manifest declarations differ in the "package" attribute.

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

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

All in all, you have a malformed AndroidManifest file. Fix that and the demo project will compile just fine.

you should delete following part:

<<<<<<< Original
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.testme.myapplication">

    <application android:allowBackup="true" android:label="@string/app_name"
        android:icon="@drawable/ic_launcher" android:theme="@style/AppTheme">

    </application>

</manifest>

=======

and delete this line at the end too:

>>>>>>> Added

Android Studio generates manifest for different devices and merges with the old one, but I don't know why, it doesnt delete the default generated manifest for mobile devices.

Edit: you may want to add this to your new manifest as well, to avoid missing package name:

package="com.testme.myapplication"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM