当前位置:   article > 正文

Android7.0拍照报错:file:///storage/0/example.jpg exposed beyond app through ClipData.Item.getUri_file:///storage/emulated/0/dcim/20231021_090429.jp

file:///storage/emulated/0/dcim/20231021_090429.jpg exposed beyond app throu

Android7.0调用相机时出现新的错误:

android.os.FileUriExposedException: file:///storage/emulated/0/**/**/e820cc60-cae5.jpg exposed beyond app through ClipData.Item.getUri()

解决办法:

在Application的onCreat()方法中添加以下代码:

  1. if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
  2. StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder();
  3. StrictMode.setVmPolicy(builder.build());
  4. builder.detectFileUriExposure();
  5. }
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/盐析白兔/article/detail/153136
推荐阅读
相关标签
  

闽ICP备14008679号