package="com.yjf.csu.readcontactpeople">
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
這時我在manifest中加的權限
Cursor cursor = contentResolver.query(uri, new String[]{"contact_id"}, null, null, null); //這是報錯的代碼
Caused by: java.lang.SecurityException: Permission Denial: opening provider com.android.providers.contacts.ContactsProvider2 from ProcessRecord{6b43e34 2995:com.yjf.csu.readcontactpeople/u0a61} (pid=2995, uid=10061)**requires android.permission.READ_CONTACTS or android.permission.WRITE_CONTACTS**
你看你的targetSDkVersion是不是23 是的話,需要做權限判斷的。