Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Permission Denial: ... requires android.permission.WRITE_EXTERNAL_STORAGE

So the latest wall I've hit is in trying to write to the sdcard with my program. I'm getting:

[2011-05-28 10:00:16 - LatinDictionary] ActivityManager: java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.joelman.latindictionary/.LatinDictionary } from null (pid=-1, uid=-1) requires android.permission.WRITE_EXTERNAL_STORAGE

As you can see from my manifest below, I've added the permission (I also tried adding it to each of the activities, to no avail). What am I missing?

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.joelman.latindictionary"
      android:versionCode="1"
      android:versionName="1.0">
     <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission>
     <application android:icon="@drawable/icon" android:label="@string/app_name" android:permission="android.permission.WRITE_EXTERNAL_STORAGE">
     <activity android:name=".LatinDictionary">
     <intent-filter>
     <action android:name="android.intent.action.MAIN"></action>
<category android:name="android.intent.category.LAUNCHER"></category>
</intent-filter>
<intent-filter><action android:name="android.intent.action.SEARCH"></action>
</intent-filter>
</activity>

<provider android:name="DictionaryProvider" android:authorities="com.joelman.latindictionary.DictionaryProvider"></provider>
</application>

</manifest> 

TIA, Joel

like image 763
user568259 Avatar asked May 28 '11 14:05

user568259


2 Answers

It should be like this:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.joelman.latindictionary"
      android:versionCode="1"
      android:versionName="1.0">
     <application android:icon="@drawable/icon" android:label="@string/app_name" android:permission="android.permission.WRITE_EXTERNAL_STORAGE">
     <activity android:name=".LatinDictionary">
     <intent-filter>
     <action android:name="android.intent.action.MAIN"></action>
<category android:name="android.intent.category.LAUNCHER"></category>
</intent-filter>
<intent-filter><action android:name="android.intent.action.SEARCH"></action>
</intent-filter>
</activity>

<provider android:name="DictionaryProvider" android:authorities="com.joelman.latindictionary.DictionaryProvider"></provider>
</application>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission>
</manifest> 
like image 199
Luke Vo Avatar answered Nov 10 '22 02:11

Luke Vo


Put the permission line outside the application tag, but within the manifest one

like image 42
JasonTheRand Avatar answered Nov 10 '22 02:11

JasonTheRand