Android 11 Pixel 2
I have a working app on most devices. It's been out for a few years. I recently upgraded the phone to Android 11 and the API to 29. I am noticing some behavior with the camera. When I use the camera and then fire the start cropping, there is no image in the CropActivity.
Has anyone experienced this and aware of the fix?
try this : added android:requestLegacyExternalStorage="true" in AndroidManifest.xml
<application android:requestLegacyExternalStorage="true" .../>
android:requestLegacyExternalStorage="true" does no longer work from Android 11. I met the same problem on the emulator running Android 11.
If I set "targetSdkVersion = 29", I can see image source selection, and after then picked camera option, I can not see taken picture file. Even more, If I set "targetSdkVersion = 30", I can not even see any option of the image source selection.
To followup on this I was able to get the error when coming back from taking a picture. The image selection works fine.
java.lang.RuntimeException: Failed to load sampled bitmap: file:///storage/emulated/0/Android/data/com.example/cache/pickImageResult.jpeg File is not a picture
I can reproduce it in my physical Google Pixel 4 device, and also in Android emulator of Pixel 3a, on API 30.
When debugging, seems like inside the function getCaptureImageOutputUri() in CropImage.java,
context.getExternalCacheDir(); is returning null
Not really sure whether is API related but some folks on stackoverflow says that:
This can also happen if you're running on a device or emulator without any external storage.
Which could be why Pixel devices are having issues.
please check this
Reading writing images from external memory is not allowed in android 11. If someone find a solution please do share.
Hey!
I start a new project to handover this library https://github.com/CanHub/Android-Image-Cropper
The ideia is that we keep improving because this project don’t have updates since 2018
Hope I can count with your help.
Open to contribute, next pieces of work will be Android 11 permissions, refactor into Kotlin and ActivityContract
To followup on this I was able to get the error when coming back from taking a picture. The image selection works fine.
java.lang.RuntimeException: Failed to load sampled bitmap:
file:///storage/emulated/0/Android/data/com.example/cache/pickImageResult.jpeg File is not a picture
Did you find any solution for this ? I am getting same issue for Camera selection,
To followup on this I was able to get the error when coming back from taking a picture. The image selection works fine.
java.lang.RuntimeException: Failed to load sampled bitmap:
file:///storage/emulated/0/Android/data/com.example/cache/pickImageResult.jpeg File is not a pictureDid you find any solution for this ? I am getting same issue for Camera selection,
@jagdeepmohd Please check the new library, I believe this was fixed.
https://github.com/CanHub/Android-Image-Cropper
To followup on this I was able to get the error when coming back from taking a picture. The image selection works fine. java.lang.RuntimeException: Failed to load sampled bitmap:
file:///storage/emulated/0/Android/data/com.example/cache/pickImageResult.jpeg File is not a pictureDid you find any solution for this ? I am getting same issue for Camera selection,
@jagdeepmohd Please check the new library, I believe this was fixed.
https://github.com/CanHub/Android-Image-Cropper
In Android 11 Uri lacks 'file' scheme: content: //packagename.cropper.fileprovider/my_images/Pictures/imagename.jpg
@baonq-2356 Thanks for reply. Issue is resolved with new library.
@jagdeepmohd i try with library: https://github.com/CanHub/Android-Image-Cropper version 2.1.1 then get that error so, what is newest library?
@jagdeepmohd i try with library: https://github.com/CanHub/Android-Image-Cropper version 2.1.1 then get that error so, what is newest library?
sorry, i has confused, this isn't your library issue ^^
If something is wrong or odd on the CanHub lib please open a issue so we can tackle it ;)