Android 7.0以上版本 系统解决拍照的问题 exposed beyond app through ClipData.Item.getUri()...

解决方案1:

android.os.FileUriExposedException: file:///storage/emulated/0/ilive/images/photophoto.jpeg exposed beyond app through ClipData.Item.getUri()

解决办法: 
将下面的代码拷贝到application类里面,

  // android 7.0系统解决拍照的问题
        StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); StrictMode.setVmPolicy(builder.build()); builder.detectFileUriExposure();

 

这样,问题就可以解决了。

 

解决方案2:

应用内自动升级,下载安装包后抛出异常,先贴个错误 
错误信息 
Log:

android.os.FileUriExposedException: file:///storage/emulated/0/aiyou.apk exposed beyond app through Intent.getData()

问题分析: 
1.版本不支持 
修改platforms>android中的AndroidManifest.xml

<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="23" />
  • 1

尽量保持android:targetSdkVersion版本在24以下

If you have an app that shares files with other apps using a Uri, you may have encountered this error on API 24+.

2.权限问题 
同样修改AndroidManifest.xml文件,添加

<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
  • 1

这个主要影响Android 8.x版本

转载于:https://www.cnblogs.com/yelanggu/p/9635759.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值