Android 报错:Caused by: android.os.FileUriExposedException:
16lz
2021-01-23
具体错误: 在选择选择图片或拍照 后进行图片裁剪 报错:
Caused by: android.os.FileUriExposedException: file:///storage/emulated/0/maps/picture.jpg exposed beyond app through Intent.getData()
造成原因:Android 版本不一样 权限的申请方式不一样,例Android7.0+ 文件读取时
解决方法:(两种)1.链接:百度到最多的方法 (此方法没有亲测,因为麻烦)
2.在 Activity的onCreate()里添加 两行代码 (亲测,有用)
StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder();StrictMode.setVmPolicy(builder.build());
第二种方法的详解地址:https://blog.csdn.net/tanghongchang123/article/details/68490946
更多相关文章
- Android中滑屏初探 ---- scrollTo 以及 scrollBy方法使用说明
- Android异步加载图像小结 (含线程池,缓存方法)
- android上一些方法的区别和用法的注意事项
- android WebView 图片缩放功能小结
- Android实现下载文件功能的方法
- Android 主流图片库Picasso Glide Fresco对比分析
- Android 通讯录中用到的关于按名字首字母排序方法