SecurityException:权限拒绝。从xxx打开提供程序xxx,不从uid 10027导出

时间:2013-04-17 10:22:58

标签: android android-contentprovider

我有一个项目A作为库jar文件,其中包含一个ContentProvider。然后我需要在项目B中使用它。正如Manifest中声明的那样:

        <provider
        android:authorities="com.gezbox.android.onepiece"
        android:exported="true"
        android:name="com.gezbox.android.api.provider.GezboxProvider"/>

但问题出现了:

 04-17 17:55:50.695: WARN/dalvikvm(5527): threadid=13: thread exiting with uncaught exception (group=0x40def300)
04-17 17:55:50.695: WARN/ActivityManager(258): Permission denied: checkComponentPermission() owningUid=10027
04-17 17:55:50.695: WARN/ActivityManager(258): Permission denied: checkComponentPermission() owningUid=10027
04-17 17:55:50.695: WARN/ActivityManager(258): Permission Denial: opening provider com.gezbox.android.api.provider.GezboxProvider from ProcessRecord{415d5e08 5527:com.gezbox.android.onepiece/u0a31} (pid=5527, uid=10031) that is not exported from uid 10027
04-17 17:55:50.711: ERROR/AndroidRuntime(5527): FATAL EXCEPTION: IntentService[GezboxService]
        java.lang.SecurityException: Permission Denial: opening provider com.gezbox.android.api.provider.GezboxProvider from ProcessRecord{415d5e08 5527:com.gezbox.android.onepiece/u0a31} (pid=5527, uid=10031) that is not exported from uid 10027

        at android.os.Parcel.readException(Parcel.java:1425)
        at android.os.Parcel.readException(Parcel.java:1379)
        at android.app.ActivityManagerProxy.getContentProvider(ActivityManagerNative.java:2354)
        at android.app.ActivityThread.acquireProvider(ActivityThread.java:4219)
        at android.app.ContextImpl$ApplicationContentResolver.acquireProvider(ContextImpl.java:1688)
        at android.content.ContentResolver.acquireProvider(ContentResolver.java:1083)
        at android.content.ContentResolver.acquireContentProviderClient(ContentResolver.java:1146)
        at android.content.ContentResolver.applyBatch(ContentResolver.java:896)
        at com.gezbox.android.api.processor.PostOrderProcessor.updateContentProvider(PostOrderProcessor.java:57)
        at com.gezbox.android.api.processor.PostOrderProcessor.post_order(PostOrderProcessor.java:33)
        at com.gezbox.android.api.GezboxService.onHandleIntent(GezboxService.java:196)
        at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:137)
        at android.os.HandlerThread.run(HandlerThread.java:60)

1 个答案:

答案 0 :(得分:0)

问题解决了。我更改了项目B中提供商的提供商uri。

是的,我是如此倾倒......

图书馆项目是由另一个人编写的,每次编译项目之前我都需要手动更改uri以使其适合正确的路径。