1. 程式人生 > >java.lang.SecurityException: Permission Denial: opening provider

java.lang.SecurityException: Permission Denial: opening provider

報錯原因:

 java.lang.SecurityException: Permission Denial: opening provider 

內容解析者呼叫內容提供者方法使產生錯我

Caused by: java.lang.SecurityException: Permission Denial: opening provider 

com.xiaoshuai.www.myapplication.AccpimtProvider from ProcessRecord{336a1f26 

13386:com.xiaoshuai.www.myapplication3/u0a144} (pid=13386, uid=10144) that is not exported 

from uid 10143

解決辦法:

           在AndroidManifest .xml  註冊provider  新增屬性  android:exported="true"

 <provider
            android:authorities="com.xiaoshuai.db"
            android:exported="true"
            android:name=".AccountProvider" />