android清单文件中不允许使用此元素

时间:2015-10-14 07:53:00

标签: android xml manifest

我在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)

不知道如何解决这个问题,因为很多这些属性都是从我的清单文件中删除的,而不是从调试/清单文件中删除的:(

请帮忙

1 个答案:

答案 0 :(得分:1)

如果您从清单中删除了这些行,但它们仍然在您的调试中,那么听起来您的清单位于错误的文件夹中。你的目录结构可能发生了一些变化,你没有意识到或打算这样做。

将清单放在正确的文件夹中,并确保您正在编辑正确的文件夹。

请参阅此相关帖子:Why is Android Studio reporting "URI is not registered"?

也可能是你在.xcdatamodel文件中设置它们 - 检查那里。

相关问题