I\'m working on a simple app that browses through the user\'s contacts. Unfortunately I keep getting the following error:
java.lang.SecurityException: Permission
I was totally stuck on this until I read this article about how permissions are handled starting with SDK 23. The critical hint:
If the application's targetSdkVersion is set to less than 23. It will be assumed that application is not tested with new permission system yet and will switch to the same old behavior: user has to accept every single permission at install time and they will be all granted once installed !
I opened up my gradle.build
file and changed targetSdkVersion 23
to targetSdkVersion 22
, and now everything works great! I'll eventually find time to build in the new permissions system and switch back to targetSdkVersion 23
, which is probably the more correct answer. This is a temporary shortcut.