ContentProvider访问权限错误的解决

在AndroidManifest.xml里注册ContentProvider时如果没有加  android:exported="true" 有时会出错
            android:exported="true"
android:name="com.android.provider.StudentProvider"
android:authorities="com.android.provider.StudentProvider"
/>
出现这样的错时,就在AndroidManifest.xml加上一句上面的的语句
05-21 11:33:46.211: E/AndroidRuntime(24372): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.testprovider/com.example.testprovider.MainActivity}: java.lang.SecurityException: Permission Denial: opening provider com.zfs.myprovider.db.MyProvider from ProcessRecord{5375da94 24372:com.example.testprovider/u0a10053} (pid=24372, uid=10053) that is not exported from uid 10052

你可能感兴趣的:(学习笔记)