老师,怎么一摸一样的代码,运行就出错呢?实在是找不出有哪里不同,只好发上来请教了。。。
下面是我从log中copy出来的红色部分的错误信息,老师帮我看下,这是哪里出问题了,我看不懂啊:
01-18 14:39:08.638 6252-6252/com.mingrisoft.a111_2 E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.mingrisoft.a111_2, PID: 6252
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mingrisoft.a111_2/com.mingrisoft.a111_2.RetrieveDataActivity}: java.lang.SecurityException: Permission Denial: opening provider com.android.providers.contacts.ContactsProvider2 from ProcessRecord{e1e5369 6252:com.mingrisoft.a111_2/u0a87} (pid=6252, uid=10087) requires android.permission.READ_CONTACTS or android.permission.WRITE_CONTACTS
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2665)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Caused by: java.lang.SecurityException: Permission Denial: opening provider com.android.providers.contacts.ContactsProvider2 from ProcessRecord{e1e5369 6252:com.mingrisoft.a111_2/u0a87} (pid=6252, uid=10087) requires android.permission.READ_CONTACTS or android.permission.WRITE_CONTACTS
at android.os.Parcel.readException(Parcel.java:1684)
at android.os.Parcel.readException(Parcel.java:1637)
at android.app.ActivityManagerProxy.getContentProvider(ActivityManagerNative.java:4199)
at android.app.ActivityThread.acquireProvider(ActivityThread.java:5476)
at android.app.ContextImpl$ApplicationContentResolver.acquireUnstableProvider(ContextImpl.java:2239)
at android.content.ContentResolver.acquireUnstableProvider(ContentResolver.java:1517)
at android.content.ContentResolver.query(ContentResolver.java:516)
at android.content.ContentResolver.query(ContentResolver.java:474)
at com.mingrisoft.a111_2.RetrieveDataActivity.getQueryData(RetrieveDataActivity.java:26)
at com.mingrisoft.a111_2.RetrieveDataActivity.onCreate(RetrieveDataActivity.java:20)
at android.app.Activity.performCreate(Activity.java:6679)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2618)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)?
at android.app.ActivityThread.-wrap12(ActivityThread.java)?
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)?
at android.os.Handler.dispatchMessage(Handler.java:102)?
at android.os.Looper.loop(Looper.java:154)?
at android.app.ActivityThread.main(ActivityThread.java:6119)?
at java.lang.reflect.Method.invoke(Native Method)?
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)?
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)?