Manifest.xml错误

时间:2013-03-10 19:51:53

标签: android xml

我正在开发一个刚刚开始使用Android SDK的项目。在Manifest.xml中,我找不到它所说的错误。错误是:

[2013-03-10 12:34:22 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper]   Parser exception for C:\Users\Zac\workspace\SlenderAR\AndroidManifest.xml: Attribute "name" bound to namespace "http://schemas.android.com/apk/res/android" was already specified for element "uses- permission".

我的Manifest.xml文件包含以下内容:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.slenderar"
    android:versionCode="1"
    android:versionName="1.0" >
    <uses-permission
        android:name="android.permission.CAMERA"
        android:name="android.permission.FINE_LOCATION" />

    <uses-feature
        android:name="android.hardware.camera" android:required="true"
        android:name="android.hardware.camera.autofocus" android:required="false"
        android:name="android.hardware.location.gps" android:required="true"
        android:name="android.hardware.sensor.compass" android:required="true"
        android:name="android.hardware.sensor.gyroscope" android:required="true"
        android:name="android.hardware.sensor.accelerometer" android:required="true" />

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="17" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" android:debuggable="true">
        <activity
            android:name="com.example.slenderar.MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

</manifest>

4 个答案:

答案 0 :(得分:3)

你的块

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

应该是

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

每个权限块中只允许使用一个名称。类似的事情可以说是使用功能块。

答案 1 :(得分:1)

不要将两个权限相互组合:

试试这段代码:

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

答案 2 :(得分:0)

也删除

<?xml version="1.0" encoding="utf-8"?>

并使用正确的代码语法

替换旧的权限
<uses-permission android:name="android.permission.FINE_LOCATION"></uses-permission>
<uses-permission android:name="android.permission.CAMERA"></uses-permission>

答案 3 :(得分:-3)

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    android:versionCode="1"
    android:versionName="1.0" >
    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="17" />
    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.example.sqlitenew.MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
<uses-permission android:name="android.permission.FINE_LOCATION"></uses-permission>
<uses-permission android:name="android.permission.CAMERA"></uses-permission>
</manifest>