码迷,mamicode.com
首页 > 编程语言 > 详细

java.lang.SecurityException: Permission Denial: opening provider

时间:2015-04-06 21:54:24      阅读:338      评论:0      收藏:0      [点我收藏+]

标签:

在测试调用外部提供的ContentProvider时候报一下错误:


java.lang.SecurityException: Permission Denial: opening provider com.example.onehw.BookProvider from ProcessRecord{b2f1b230 8449:com.example.adtest/u0a53} (pid=8449, uid=10053) that is not exported from uid 10052
at android.os.Parcel.readException(Parcel.java:1465)
at android.os.Parcel.readException(Parcel.java:1419)
at android.app.ActivityManagerProxy.getContentProvider(ActivityManagerNative.java:2848)
at android.app.ActivityThread.acquireProvider(ActivityThread.java:4415)
at android.app.ContextImpl$ApplicationContentResolver.acquireProvider(ContextImpl.java:2192)
at android.content.ContentResolver.acquireProvider(ContentResolver.java:1378)
at android.content.ContentResolver.insert(ContentResolver.java:1184)
at com.example.adtest.ProverderTest.testInsert(ProverderTest.java:16)
at java.lang.reflect.Method.invokeNative(Native Method)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:191)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:176)
at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:554)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1701)


是权限的问题,在AndroidManifest.xml 加上红色部分就解决


<provider android:name="BookProvider" android:authorities="com.example.provides.bookprovider" android:exported="true" />















java.lang.SecurityException: Permission Denial: opening provider

标签:

原文地址:http://blog.csdn.net/ldl22847/article/details/44905755

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!