CanHub / Android-Image-Cropper

Image Cropping Library for Android, optimised for Camera / Gallery.
Apache License 2.0
1.21k stars 249 forks source link

[BUG] - FileUriExposedException when trying to lunch only camera intent. #274

Closed ArmChilingarov closed 2 years ago

ArmChilingarov commented 2 years ago

Describe the bug App gets crashed when I want to open only camera intent .

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.croppersample/com.canhub.cropper.CropImageActivity}: android.os.FileUriExposedException: file:///storage/emulated/0/Android/data/com.example.croppersample/cache/pickImageResult.jpeg exposed beyond app through ClipData.Item.getUri()

To Reproduce Steps to reproduce the behavior: in a crop image sample use this part of code. private val customCropImage = registerForActivityResult(CropImageContract()) { ... }

customCropImage.launch( options { setImagePickerContractOptions(PickImageContractOptions(false,true)) })

Media

Screen Shot 2021-11-23 at 18 30 17

Smartphone (please complete the following information):

@Canato

Canato commented 2 years ago

Duplicated of #253

ArmChilingarov commented 2 years ago

Hey @Canato .

You marked the issue as a duplicate of #253 , but this is absolutely different issue. If you need more details, I can provide to you .

Canato commented 2 years ago

Sorry @ArmChilingarov you are right, I'm reopening, but hopefully the PR I'm working will fix this too

Canato commented 2 years ago

If possible please test

To test this changes implementation 'com.github.CanHub:Android-Image-Cropper:271-read-files-without-permission-38df1455d6-1'

All feedbacks at #280