权限拒绝:打开提供程序 com.miui.gallery.provider.GalleryOpenProvider

sre*_*ith 7 android inputstream android-bitmap xiaomi

java.lang.SecurityException:权限拒绝:从 ProcessRecord{932688f 12849:mobi.hubbler.app/u0a158} (pid=12849,uid=10158) 打开未从 uid 10034 导出的提供程序 com.miui.gallery.provider.GalleryOpenProvider

    InputStream is = null;
    BitmapFactory.Options options = new BitmapFactory.Options();
    options.inJustDecodeBounds = true;
    is = context.getContentResolver().openInputStream(bitmapUri);
    BitmapFactory.decodeStream(is, null, options); 
Run Code Online (Sandbox Code Playgroud)

尝试从 uri 获取位图。此问题仅发生在 MI(小米)设备上。

小智 -3

android.permission.READ_EXTERNAL_STORAGE