首页 > 代码库 > Android使用通讯录的权限问题
Android使用通讯录的权限问题
06-02 11:49:53.676: E/AndroidRuntime(12974): FATAL EXCEPTION: main
06-02 11:49:53.676: E/AndroidRuntime(12974): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.*****.Main}: java.lang.SecurityException: Permission Denial: reading com.android.providers.contacts.ContactsProvider2 uri content://com.android.contacts/contacts from pid=12974, uid=10110 requires android.permission.READ_CONTACTS, or grantUriPermission()
在AndroidManifest.xml添加如下权限:
<uses-permission android:name="android.permission.READ_CONTACTS" />
出现下面的告警信息:
<uses-permission> tag appears after <application> tag
原因:<uses-permission> 需放在application前面
<uses-permission android:name="android.permission.READ_CONTACTS" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >