訪問自己創建的Contentprovider 拋異常 提示Permission Denial:

以下轉自百度知道


問:
自己創建了個ContentProvider
以下是部分標籤
<provider
            android:name="com.android.provider.StudentProvider"
            android:authorities="com.android.provider.StudentProvider"     
            />
然後又用其他程序調用它時,總提示權限錯誤
java.lang.SecurityException: Permission Denial: opening provider com.android.provider.StudentProvider from ProcessRecord{b4054ef8 7614:com.example.test/u0a76} (pid=7614, uid=10076) that is not exported from uid 10068
我沒在provider裏邊設權限啊 爲什麼總是這樣??



答:
添加權限
<provider
            android:exported="true"
            android:name="com.android.provider.StudentProvider"
            android:authorities="com.android.provider.StudentProvider"     
            />

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章