2

我正在使用最新版本的 Android Studio 0.8.14。

在使用 android 5.0 为电视创建新项目后,我收到一个 gradle 错误说明。

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

在查看 androidmanifest 后,我​​发现了一些问题。这是一个全新的项目。有任何想法吗 ?

我将清单放在下面,您可以清楚地看到原始和添加的单词。似乎是一些合并问题或什么?

我尝试删除原始标记和无效标记。但这似乎不起作用。我现在收到一个错误说

“清单合并失败:AndroidManifest.xml 清单中的主要 AndroidManifest.xml:未声明包属性”

这是原始清单,未触及。

<<<<<<< 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
4

2 回答 2

0

您的AndroidManifest.xml文件中只能有一个元素。

此外,两个清单声明的“package”属性不同。

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

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

总而言之,您有一个格式错误的 AndroidManifest 文件。修复它,演示项目将编译得很好。

于 2014-10-30T15:45:03.970 回答
0

您应该删除以下部分:

<<<<<<< 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>

=======

并在最后删除这一行:

>>>>>>> Added

Android Studio 为不同的设备生成清单并与旧的合并,但我不知道为什么,它不会删除默认生成的移动设备清单。

编辑:您可能还希望将其添加到新清单中,以避免丢失包名称:

包="com.testme.myapplication"

于 2014-11-20T10:03:33.270 回答