解决android.os.FileUriExposedException,exposed beyond app through ClipData.Item.getUri() 异常
2018-03-06 17:05
896 查看
最近公司的项目在Android 7.0的测试机中出现以下的异常:
解决方法如下:
1.在相对应的页面中,写如下的方法:
2.在onCreate中调用上述的方法。
# main(1) android.os.FileUriExposedException file:///storage/emulated/0/xiangmu/3462884.jpg exposed beyond app through ClipData.Item.getUri() android.os.StrictMode.onFileUriExposed(StrictMode.java:1816) android.net.Uri.checkFileUriExposed(Uri.java:2350) android.content.ClipData.prepareToLeaveProcess(ClipData.java:832) android.content.Intent.prepareToLeaveProcess(Intent.java:9052) android.content.Intent.prepareToLeaveProcess(Intent.java:9037) android.app.Instrumentation.execStartActivity(Instrumentation.java:1530) android.app.Activity.startActivityForResult(Activity.java:4391) android.app.Activity.startActivityForResult(Activity.java:4335) com.i8dayou.an.zb.push.TCPublishSettingActivity.a(TCPublishSettingActivity.java:343) com.i8dayou.an.zb.push.TCPublishSettingActivity.c(TCPublishSettingActivity.java:55) com.i8dayou.an.zb.push.TCPublishSettingActivity$3.onClick(TCPublishSettingActivity.java:306) android.view.View.performClick(View.java:5646) android.view.View$PerformClick.run(View.java:22459) android.os.Handler.handleCallback(Handler.java:761) android.os.Handler.dispatchMessage(Handler.java:98) android.os.Looper.loop(Looper.java:156) android.app.ActivityThread.main(ActivityThread.java:6523) java.lang.reflect.Method.invoke(Native Method) com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:941) com.android.internal.os.ZygoteInit.main(ZygoteInit.java:831)
解决方法如下:
1.在相对应的页面中,写如下的方法:
private void initPhotoError(){ // android 7.0系统解决拍照的问题 StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); StrictMode.setVmPolicy(builder.build()); builder.detectFileUriExposure(); }
2.在onCreate中调用上述的方法。
相关文章推荐
- [置顶] Android 7.0 系统解决拍照的问题 exposed beyond app through ClipData.Item.getUri()
- 安卓7.0拍照,FileUriExposedException: file:/// ****** exposed beyond app through ClipData.Item.getUri()
- Android系统7.0以上遇到exposed beyond app through ClipData.Item.getUri
- 解决exposed beyond app through ClipData.Item.getUri() 错误
- android 7.0拍照问题file:///storage/emulated/0/photo.jpeg exposed beyond app through ClipData.Item.getUri
- 下载APK后打开APK,在安装时的报错 android.os.FileUriExposedException:exposed beyond app through Intent.getData()
- android.os.FileUriExposedException: file:///storage/emulated/0/ehcda exposed beyond app through...
- android.os.FileUriExposedException: file:///sdcard/update/wiiwork.apk exposed beyond app through I
- 安卓7.0遇到 android.os.FileUriExposedException: file:///storage/emulated.. exposed beyond app through Intent.getData()
- android 7.0拍照问题file:///storage/emulated/0/photo.jpeg exposed beyond app through ClipData.Item.getUri
- android.os.FileUriExposedException:file:///storage/emulated/0/1502852028434.jpg exposed beyond app t
- 解决异常 android.os.FileUriExposedException
- 解决Android7.0系统 调用系统相机、系统播放器播放视频、切图兼容问题,报异常android.os.FileUriExposedException
- 解决Android7.0系统 调用系统相机、系统播放器播放视频、切图兼容问题,报异常android.os.FileUriExposedException
- android-解决 Android N 上 报错:android.os.FileUriExposedException
- 解决 Android N 上 报错:android.os.FileUriExposedException
- 解决 Android N 上报错:android.os.FileUriExposedException: file:///storage/emulated/0/
- Android7.0解决 android.os.FileUriExposedException: file:///storage/emulated/0/
- 解决 Android N 上报错:android.os.FileUriExposedException: file:///storage/emulated/0/
- Android 7.0 系统相机崩溃解决android.os.FileUriExposedException