Permissions Not Working

SapphireSun picture SapphireSun · Dec 26, 2010 · Viewed 10.2k times · Source

I've been having some odd problems with permission in Android. I am trying to just get a list of the google calendars a particular user has, but first I need to let them pick the account.

I included this line in my manifest:

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

However I get this error:

12-26 03:26:31.004 13841 13841 E AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{....}: java.lang.SecurityException: caller uid 10105 lacks any of android.permission.GET_ACCOUNTS

I had tried something similar with gaining access to the undocumented Calendar API with READ_CALENDAR and WRITE_CALENDAR, but I had similar exceptions (although probably for different reasons - I thought it might be worth mentioning in case it wasn't).

Please clue me in on what I'm doing wrong!

Thanks!

Answer

CommonsWare picture CommonsWare · Dec 26, 2010

Either your <uses-permission> is in the wrong place (should be a child of <manifest> and a peer of <application>), or GET_ACCOUNTS is not a permission that SDK applications can hold. The documentation is singularly lousy about indicating which permissions are and are not eligible for SDK applications.