react-native-image-crop-picker icon indicating copy to clipboard operation
react-native-image-crop-picker copied to clipboard

Still need requestLegacyExternalStorage="true" if targetSdkVersion = 29

Open howg0924 opened this issue 3 years ago • 12 comments

Version

Tell us which versions you are using:

  • react-native-image-crop-picker v0.35.1
  • react-native v0.62.2

Platform

Tell us to which platform this issue is related

Android

Expected behaviour

ImagePicker.openPicker() should return the selected image information.

Actual behaviour

Returns error code E_NO_IMAGE_DATA_FOUND and error message Invalid image selected on some devices

This problem start to happen after we upgrading targetSdkVersion from 28 to 29. And it mostly happened on Android 10 devices, but not all Android 10 devices will have this problem. Here are some devices our customers have ever experienced this problem:

Xiaomi Mi 9T Xiaomi MI 8 Pro samsung SM-A505GN samsung SM-G986B samsung SM-A307GN samsung SM-G9650 samsung SM-G960F samsung SM-A7050 samsung SM-N9860 realme RMX1921 realme RMX2144 vivo vivo 1920 vivo vivo 1935 HTC HTC Desire 20 Pro OPPO CPH1941 HUAWEI LIO-L29 HUAWEI LYA-L29 asus ASUS_I01WD

After adding the android:requestLegacyExternalStorage="true" to AndroidManifest.xml, the problem is gone. Therefore, it seems 1ddd03e released in react-native-image-crop-picker 0.29.0 does not solve all issues related to new SDK 29 permission model completely?

This need to be fixed as the this workaround will no longer work if you target SDK 30.

Steps to reproduce

  1. set targetSdkVersion to 29 and don’t set requestLegacyExternalStorage in AndroidManifest.xml

  2. call ImagePicker.openPicker()

  3. some devices will return error E_NO_IMAGE_DATA_FOUND instead of the selected photo information

howg0924 avatar Dec 14 '20 09:12 howg0924

@howg0924 what is the error message you are getting? Invalid image selected?

superandrew213 avatar Dec 15 '20 02:12 superandrew213

@superandrew213 Yes, the error message is Invalid image selected.

Do you know what caused this? Thanks a lot~~~.

howg0924 avatar Dec 15 '20 16:12 howg0924

It seems 1ddd03e only solved the issue of writing the temp output image file on new SDK 29 permission model.

Maybe just as this article said:

https://medium.com/@sriramaripirala/android-10-open-failed-eacces-permission-denied-da8b630a89df

react-native-image-crop-picker also need to change its way when fetching the source image?

howg0924 avatar Dec 15 '20 17:12 howg0924

Not sure.

Adding android:requestLegacyExternalStorage="true" fixes it but not for all users. Some users still get this issue on SDK29.

Will try v035.2.

superandrew213 avatar Dec 16 '20 00:12 superandrew213

I am not getting android:requestLegacyExternalStorage="true" even SDK version 29, still facing issue in Xiaomi 8a dual phone, openPicker is working fine, but on openCamera after click image, it goes back to the splash screen.

help with this.

aashu700 avatar Dec 16 '20 08:12 aashu700

Same problem here, some users can't select the image and cellphone crashes, any help?

joaonew avatar Jan 05 '21 15:01 joaonew

android:requestLegacyExternalStorage="true" Will be not working on Android 11. Have any suggest to solve it?

sinhpn92 avatar Jan 18 '21 12:01 sinhpn92

@sinhpn92 link this may help

aashu700 avatar Jan 18 '21 17:01 aashu700

Until this is fixed: Has anyone tried setting preserveLegacyExternalStorage=true?

ejain avatar Jul 24 '21 00:07 ejain

Until this is fixed: Has anyone tried setting preserveLegacyExternalStorage=true?

As far as I understand it, this flag is only to enable data migration when the users upgrades from Android 10 to 11. So it should have nothing to do with access / scope management itself, but rather merge old (non-scoped) data to the new system.

See https://developer.android.com/training/data-storage/use-cases#maintain_access_to_the_legacy_storage_location_for_data_migration for the relevant info.

KochMario avatar Aug 02 '21 08:08 KochMario

try version https://github.com/ivpusic/react-native-image-crop-picker/releases/tag/v0.38.0

ivpusic avatar Jun 29 '22 08:06 ivpusic

Version

Tell us which versions you are using:

  • react-native-image-crop-picker v0.35.1
  • react-native v0.62.2

Platform

Tell us to which platform this issue is related

Android

Expected behaviour

ImagePicker.openPicker() should return the selected image information.

Actual behaviour

Returns error code E_NO_IMAGE_DATA_FOUND and error message Invalid image selected on some devices

This problem start to happen after we upgrading targetSdkVersion from 28 to 29. And it mostly happened on Android 10 devices, but not all Android 10 devices will have this problem. Here are some devices our customers have ever experienced this problem:

Xiaomi Mi 9T Xiaomi MI 8 Pro samsung SM-A505GN samsung SM-G986B samsung SM-A307GN samsung SM-G9650 samsung SM-G960F samsung SM-A7050 samsung SM-N9860 realme RMX1921 realme RMX2144 vivo vivo 1920 vivo vivo 1935 HTC HTC Desire 20 Pro OPPO CPH1941 HUAWEI LIO-L29 HUAWEI LYA-L29 asus ASUS_I01WD

After adding the android:requestLegacyExternalStorage="true" to AndroidManifest.xml, the problem is gone. Therefore, it seems 1ddd03e released in react-native-image-crop-picker 0.29.0 does not solve all issues related to new SDK 29 permission model completely?

This need to be fixed as the this workaround will no longer work if you target SDK 30.

Steps to reproduce

  1. set targetSdkVersion to 29 and don’t set requestLegacyExternalStorage in AndroidManifest.xml
  2. call ImagePicker.openPicker()
  3. some devices will return error E_NO_IMAGE_DATA_FOUND instead of the selected photo information

PR https://github.com/ivpusic/react-native-image-crop-picker/pull/1722 was merged

ddikodroid avatar Aug 17 '22 02:08 ddikodroid