-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Doesnt work on Android R / Android 11 #788
Comments
Yes, same issue on my Pixel 3XL device after upgrade to Android 11 |
Same issue being reported by hundreds of users of our apps. Anyone have a workaround for Android 11? |
Same. I downgraded the my targetSdkVersion to 29 instead of 30 and the image doesn't update. |
Hi i've noted this issue on my Pixel 3a as well running Android 11
I think this library needs to support a behaviour change outlined here, https://developer.android.com/about/versions/11/behavior-changes-all#share-content-uris |
In our app, we have minSdk as 21 and target as 28. We're updating to 29 soon (since we're being forced by the Googles) but just wanted to chime in to say that it's happening for apps targeting 28 for devices running Android 11. If anyone is able to fork the library and implement this and post a link here, I'm sure many would be grateful. This library hasn't been updated in years, and it's a shame because the alternatives out there are not good. I know I tried to move away from this library a year ago and tried 5+ other similar libraries and none of them were even close to as good as this one. A while back I switched to use the fork here: #736 in order to support picking from the Gallery consistently across all devices. This is probably an important change to include if anyone is able to update this library, as without it, selecting from Gallery does not work on all devices. |
Instead of
|
the Only Issue I see with this is that it bypasses the Crop Activity and come back to the app. So you need to add another step to send the data back to CropImage so then it can send something back.
This code is also missing Cameras in the intent as written. |
I got photo capture to work somewhat on Android 11. I followed the official guide at https://developer.android.com/training/camera/photobasics but had to make some adjustments. The root of the issue seems to be that on Android 11 you must use FileProvider.getUriForFile() to generate the photo file URI that is passed to the camera app. Android-Image-Cropper uses Uri.fromFile(). If you have Android-Image-Cropper on your project, seems like you cannot create a FileProvider by yourself since the library already includes one. So as a workaround you have to accommodate to using the library-provided FileProvider. The following code works for me on Android 11 emulator, run in a Fragment. It opens the camera directly and after returning in onActivityResult you can pass photoUri to CropImage.activity(photoUri) to crop it.
You also have to add this query in AndroidManifest.xml inside the manifest section:
Now, it would be awesome to make this change in the library directly. I think CropImage.getCaptureImageOutputUri should be updated to use FileProvider on newer Android versions. But I don't have the time to start testing this right now, gotta quickfix problems in my released apps before that 😅 |
@ajackson2907 In my case I added this:
First for gallery type apps to select image. Second for camera apps. Intents I create in this way:
|
@fAntel Thanks for the reply, I will give it a go. |
@ajackson2907 and others in this thread - do you have any suggestions for alternate libraries that do the same thing as this one? I know I tried many out a few years ago and this was the best at the time. I'd love to switch our apps to a library that's still being maintained instead of putting band aids on this one. Thanks in advance for anyone that has suggestions for migrating away from this dead library. |
@matthewkrueger Not many that give you the choice of camera or gallery, could be easier for you to fetch your own image and just use it as a crop library, here is a list, not tried any of them though or checked if they are still being maintained. https://ourcodeworld.com/articles/read/930/top-10-best-android-image-cropping-crop-widget-libraries |
please check this |
Hey! I start a new project to handover this library The ideia is that we keep improving because this project don’t have updates since Open to contribute, next pieces of work will be Android 11 permissions, refactor into Kotlin and ActivityContract |
Done and save my day. |
thanks i solved with this |
When pulling this library into a application the cropper does not work as expected on Android R / 11.
If a user gives permission to access Camera on Android 10 and below a user has the ability to choose from the Camera and the Gallery on the device.
Android R/11 the user is prompted with the view to choose but it says 'No apps can perform this action.'
The text was updated successfully, but these errors were encountered: