CanHub / Android-Image-Cropper

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

[CRASH] - Xiaomi Mi A2 Lite #276

Closed aliaksandr-chaulytka closed 2 years ago

aliaksandr-chaulytka commented 2 years ago

Lib Version 3.3.6

only one device: Xiaomi Mi A2 Lite, Android, 9 P (28)

CRASH after launch

run code -> code: cropImageCallback.launch(options { setCropMenuCropButtonIcon(R.drawable.ic_check_white_small) setAllowFlipping(allowFlipping = false) setAspectRatio(1, 1) setImagePickerContractOptions( PickImageContractOptions( includeGallery = false, includeCamera = true ) ) })

Firebase logs:

Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.praelinotradingltd.lavoria.dev/com.canhub.cropper.CropImageActivity}: android.os.FileUriExposedException: file:///storage/emulated/0/Android/data/com.praelinotradingltd.lavoria.dev/cache/pickImageResult.jpeg exposed beyond app through ClipData.Item.getUri() at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2916) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3051) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1811) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:193) at android.app.ActivityThread.main(ActivityThread.java:6694) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

Caused by android.os.FileUriExposedException: file:///storage/emulated/0/Android/data/com.praelinotradingltd.lavoria.dev/cache/pickImageResult.jpeg exposed beyond app through ClipData.Item.getUri() at android.os.StrictMode.onFileUriExposed(StrictMode.java:1978) at android.net.Uri.checkFileUriExposed(Uri.java:2371) at android.content.ClipData.prepareToLeaveProcess(ClipData.java:963) at android.content.Intent.prepareToLeaveProcess(Intent.java:10228) at android.content.Intent.prepareToLeaveProcess(Intent.java:10234) at android.content.Intent.prepareToLeaveProcess(Intent.java:10213) at android.app.Instrumentation.execStartActivity(Instrumentation.java:1669) at android.app.Activity.startActivityForResult(Activity.java:4586) at androidx.activity.ComponentActivity.startActivityForResult(ComponentActivity.java:588) at androidx.core.app.ActivityCompat.startActivityForResult(ActivityCompat.java:237) at androidx.activity.ComponentActivity$2.onLaunch(ComponentActivity.java:211) at androidx.activity.result.ActivityResultRegistry$2.launch(ActivityResultRegistry.java:167) at androidx.activity.result.ActivityResultLauncher.launch(ActivityResultLauncher.java:47) at com.canhub.cropper.CropImageActivity.onCreate(CropImageActivity.java:72) at android.app.Activity.performCreate(Activity.java:7136) at android.app.Activity.performCreate(Activity.java:7127) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1272) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2896) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3051) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1811) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:193) at android.app.ActivityThread.main(ActivityThread.java:6694) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

Canato commented 2 years ago

Could be related to #253 ???

Hey welcome πŸ‘‹ to the library and thanks for the Issue.

Can you please follow the template we have for issues? πŸ™ There are many points on the template and will help me to help you.

I will close πŸ”΄ this issue so you can reopen following the template,

Is important to remember that my work here is volunteer and to save time and have better answer help me that people use the templates.

Thanks!! πŸŽ‰

aliaksandr-chaulytka commented 2 years ago

I guess it isn't connected with #253 https://github.com/CanHub/Android-Image-Cropper/issues/253. I will not reopen this because it is just a crash after running picking camera flow.

ΠΏΡ‚, 26 нояб. 2021 Π³. Π² 13:06, Canato @.***>:

Could be related to #253 https://github.com/CanHub/Android-Image-Cropper/issues/253 ???

Hey welcome πŸ‘‹ to the library and thanks for the Issue.

Can you please follow the template we have for issues? πŸ™ There are many points on the template and will help me to help you.

I will close πŸ”΄ this issue so you can reopen following the template,

Is important to remember that my work here is volunteer and to save time and have better answer help me that people use the templates.

Thanks!! πŸŽ‰

β€” You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/CanHub/Android-Image-Cropper/issues/276#issuecomment-979844444, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE5ETOF53YAKF4FOABLNN5LUN5LZNANCNFSM5IYYFBPQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

aliaksandr-chaulytka commented 2 years ago

Please see #274. The same bug