Android Studio中的多个根标签错误(清单-<activity>问题)

时间:2019-08-16 18:07:04

标签: android android-manifest

我只是在Android上学习,不幸的是,我对“多个根标签”有一个错误,但我不知道该怎么做。我试图将“清单”移到最底端,但是没有用。

这是我的代码:

enter image description here

3 个答案:

答案 0 :(得分:3)

您需要像下面一样在<activity>内移动<manifest>部分。

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

    <dist:module dist:instant="true" />

    <activity> .... </activity>
    <activity> .... </activity>
    <activity> .... </activity>    

</manifest>

答案 1 :(得分:0)

活动位于清单标记中。另外,您缺少应用程序标签。

<manifest ... >
    <application ... >
        <activity android:name="com.example.myapp.MainActivity" ... >
        </activity>
    </application>
</manifest>

要进一步了解清单文件:

请参考:https://developer.android.com/guide/topics/manifest/manifest-intro

您还可以在Google代码示例中玩转,以帮助您了解android编码。

https://developer.android.com/samples

答案 2 :(得分:0)

您的清单现在看起来。您的清单出现什么错误?

请在说明中清楚显示