zoukankan      html  css  js  c++  java
  • 访问不了自己创建的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:38.336: E/AndroidRuntime(2035): Caused by: java.lang.SecurityException: Permission Denial: opening provider com.example.listview.provider.UserProvider from ProcessRecord{4190d088 2035:com.example.callcontentprovider/u0a10053} (pid=2035, uid=10053) that is not exported from uid 10052

    解决:

      在A程序的清单文件中provider组件注册没有添加被外部调用的属性,完整provider在清单文件中注册如下:

    <provider 
                android:exported="true"
                android:name=".provider.UserProvider"
                android:authorities="com.example.listview.userprovider"></provider>
  • 相关阅读:
    C++ sort()函数的用法
    对C++里面 的知识积累:
    codevs 1160
    hdu 1020 Encoding
    poj 2591 Set Definition
    hdu 1505,1506
    hdu 1284 钱币兑换
    hdu 1231 最大连续子序列 ,1003 Max Sum;
    尺取法
    android OTA package packing and extract to partition
  • 原文地址:https://www.cnblogs.com/luoyaqi/p/4331620.html
Copyright © 2011-2022 走看看