Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StrictMode raise android.net.Uri.checkFileUriExposed on ClipData.Item.getUri() #16

Closed
mingchen opened this issue Sep 9, 2016 · 0 comments

Comments

@mingchen
Copy link

mingchen commented Sep 9, 2016

OS: Android 6.0

在StrictMode开启后会有如下的错误,而且照片没有保存成功:

E/StrictMode: null
java.lang.Throwable: file:// Uri exposed through ClipData.Item.getUri()
at android.net.Uri.checkFileUriExposed(Uri.java:2346)
at android.content.ClipData.prepareToLeaveProcess(ClipData.java:825)
at android.content.Intent.prepareToLeaveProcess(Intent.java:8240)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1508)
at android.app.Activity.startActivityForResult(Activity.java:3930)
at android.app.Activity.startActivityForResult(Activity.java:3890)
at com.jph.takephoto.uitl.TUtils.startActivityForResult(TUtils.java:39)
at com.jph.takephoto.uitl.TUtils.captureBySafely(TUtils.java:69)
at com.jph.takephoto.app.TakePhotoImpl.onPickFromCaptureWithCrop(TakePhotoImpl.java:249)

file:// 因为安全的原因比较新版本的Android系统被废弃了, 解决方案可以参考里的使用 content:// 来替代 file:// https://stackoverflow.com/questions/32623304/when-take-photo-get-java-lang-throwable-file-uri-exposed-through-clipdata

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant