java.lang.SecurityException: Permission Denial: opening provider

在测试调用外部提供的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" />



时间: 2024-10-23 09:25:37

java.lang.SecurityException: Permission Denial: opening provider的相关文章

访问不了自己创建的Contentprovider,报错:java.lang.SecurityException: Permission Denial

情景:1.A,B两个程序,A程序提供ContentProvider:B程序访问A程序的ContendProvider 2.在A程序中已经添加权限: <provider android:name=".provider.UserProvider" android:authorities="com.example.listview.userprovider"></provider> 问题:A程序部署后,再运行B程序,报错: 03-11 21:48:

ContentProvider异常:Caused by: java.lang.SecurityException: Permission Denial

在使用ContentProvider时抛出异常:Caused by: java.lang.SecurityException: Permission Denial 原因:在Provider的 Manifest文件中 对provider的属性描述时 没有 加入 属性 android:exported="true" android:exported属性非常重要.这个属性用于指示该服务是否能够被其他应用程序组件调用或跟它交互.如果设置为true,则能够被调用或交互,否则不能.

Caused by: java.lang.SecurityException: Permission Denial: reading com.android.providers.media.MediaProvider uri content://...

在as中创建cordova中添加从相册选取照片的插件 $cordovaImagePicker 就是以上这货,调用后直接程序就崩溃了,并报错 Caused by: java.lang.SecurityException: Permission Denial: reading com.android.providers.media.MediaProvider uri content://... 添加权限 <uses-permission android:name="android.permis

Caused by: java.lang.SecurityException: Permission Denial: not allowed to send broadcast android.intent.action.HEADSET_PLUG

crash information:Caused by: java.lang.SecurityException: Permission Denial: not allowed to send broadcast android.intent.action.HEADSET_PLUG from    at android.os.Parcel.readException(Parcel.java:1465)     at android.os.Parcel.readException(Parcel.j

【Android】java.lang.SecurityException: Permission Denial: starting Intent 应用启动失败异常

异常提示 在Eclipse和Android Studio同时使用的时候,我遇到过这样一个异常,具体错误提示如下: ava.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.xxx.xxx/.activity.SplashActivity }

记录一个调了半天的问题:java.lang.SecurityException: Permission denied (missing INTERNET permission?)

Move the <uses-permission> elements outside of <application>. They need to be immediate children of the root <manifest> element. 不然就会出现crush! 不用申请权限,改个位置即可.

Android 开发之错误整理java.lang.SecurityException: Requires READ_PHONE_STATE: Neither user 10088 nor current process has android.permission.READ_PHONE_STATE.

java.lang.SecurityException: Requires READ_PHONE_STATE: Neither user 10088 nor current process has android.permission.READ_PHONE_STATE. 今天写了一款发短信的软件,拿了个酷派5879,试了下,结果不能用,把try{}catch{}去掉了,报这个错误, android.permission.READ_PHONE_STATE.没有READ_PHONE_STATE权限,

java.lang.SecurityException: JCE cannot authenticate the provider BC

和X公司对接数据,他们的开发语言是java,我们是php,双方数据通信的时候采用的加密方法是:bouncycastle 由于这个时间大神的限制,我们暂时不用PHP开发自己的加密算法,而是采用对方已有的加密包. 具体思路是: 1.将java写的的加密方法封装成jar包: 2.然后在php里面直接调用:exec("java -jar encrypt.jar")系统命令执行,实现加密解密 这里主要遇到2个问题: 1.cannot load mian class 2.调试过程中报错:java.

java.lang.SecurityException:JCE cannot authenticate the provider BC

出现:java.lang.SecurityException:JCE cannot authenticate the provider BC 2种方法:修改jdk的提供者: 在jdk/jre/lib/sercurity/java.security 增加 security.provider.11=org.bouncycastle.jce.provider.BouncyCastleProvider 导入bcprov-jdk15-145.jar