Android Namespace Missing

2019-08-28 23:57发布

问题:

I have the following in my Android manifest and I am getting an error with the following:

    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE">
    <group gid="media_rw" />
</uses-permission>

It is saying "Attribute is missing the Android namespace prefix" The exact same file before I modified it was working just fine. My full manifest is below:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.test12"
    android:versionCode="1"
    android:versionName="1.0" >
    <!-- uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission-->
    <uses-permission android:name="android.permission.WAKE_LOCK"></uses-permission>
    <uses-permission android:name="android.permission.INTERNET"></uses-permission>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"></uses-permission>
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"></uses-permission> 
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE">
        <group gid="media_rw" />
    </uses-permission>

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

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.example.test12.MainActivity"
            android:label="@string/app_name"
            android:screenOrientation="portrait" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name=".TestityTest" android:screenOrientation="portrait" />
    </application>
    <application android:name="GlobalObjects" android:label="@string/app_name" />
</manifest>

回答1:

If you check the AppManifest documentation, there is no such thing as <group gid="media_rw" />.

I know that someone use <group gid="media_rw" /> to allow the write access to SD card on Kitkat, but it applies to the Android System, not to individual apps.

You can find some related discussion here: Is Google blocking apps writing to SD cards ?.



回答2:

It turns out that I had to open the file in another editor save it and then clean and build the project again. I have no idea why it was the case.