在Android清单文件中不允许使用这些元素。

3

我在Android Studio中创建了一个新项目,这是我的清单文件:

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

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

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

当我构建文件时,我遇到了一些Gradle错误,并且打开了这个调试/清单文件:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="cro.perger.rajcica"
    android:versionCode="10"
    android:versionName="2.0.1" >

    <uses-sdk
        android:minSdkVersion="16"
        android:targetSdkVersion="23" />

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme" >
        <activity android:name="cro.perger.rajcica.rajcica" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

我遇到了以下错误:

  • URI未注册
  • 元素(versionCode、versionName、icon、allowBackup、theme、supportsRtl)不允许使用

我不知道如何解决这个问题,因为我的清单文件中删除了许多这些属性,但是在debug/manifest文件中仍然存在。

请帮忙解决。


可能是重复的问题:https://dev59.com/mmIj5IYBdhLWcg3wJCF- - Tal
不确定这是否是重复的问题,我想知道如何从调试清单文件中删除错误,因为我已经从我的主清单文件中删除了那些行? - Goran
1个回答

1
如果您从清单中删除了这些行,但它们仍然在您的调试中,则听起来像是您的清单文件放错了位置。可能是您的目录结构发生了变化,而您没有意识到或者不想让它发生。
将清单文件放到正确的文件夹中,并确保您正在编辑正确的文件。
请参阅此相关帖子:为什么Android Studio报告“URI未注册”? 也有可能是您在build.gradle文件中设置了它们-请检查那里。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接