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

Android 11 Pixel 2 #783

Open
donhill opened this issue Sep 14, 2020 · 14 comments
Open

Android 11 Pixel 2 #783

donhill opened this issue Sep 14, 2020 · 14 comments

Comments

@donhill
Copy link

donhill commented Sep 14, 2020

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?

@moonfalling
Copy link

try this : added android:requestLegacyExternalStorage="true" in AndroidManifest.xml

<application
android:requestLegacyExternalStorage="true"
.../>

@kyungin-park
Copy link

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.

@donhill
Copy link
Author

donhill commented Sep 22, 2020

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

@iori57
Copy link

iori57 commented Oct 30, 2020

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.

@Canato
Copy link

Canato commented Nov 16, 2020

please check this

@farrakhj
Copy link

Reading writing images from external memory is not allowed in android 11. If someone find a solution please do share.

@Canato
Copy link

Canato commented Nov 27, 2020

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

@jagdeepmohd
Copy link

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,

@Canato
Copy link

Canato commented Feb 23, 2021

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,

@jagdeepmohd
Please check the new library, I believe this was fixed.

https://github.com/CanHub/Android-Image-Cropper

@baonq-2356
Copy link

baonq-2356 commented Mar 2, 2021

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,

@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

@jagdeepmohd
Copy link

@baonq-2356 Thanks for reply. Issue is resolved with new library.

@baonq-2356
Copy link

@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?

@baonq-2356
Copy link

baonq-2356 commented Mar 2, 2021

@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 ^^

@Canato
Copy link

Canato commented Mar 2, 2021

If something is wrong or odd on the CanHub lib please open a issue so we can tackle it ;)

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

8 participants