cordova-plugin-photo-library icon indicating copy to clipboard operation
cordova-plugin-photo-library copied to clipboard

Can't save image on Android 10

Open roxteddy opened this issue 4 years ago • 9 comments

Hello,

When I try to save an image on Android 10, I get this error message : "ENOENT (No such file or directory)"

Any idea ?

roxteddy avatar Sep 10 '19 12:09 roxteddy

Hi @roxteddy . Could be a problem with weird URLs that dont translate well to a filename/folder on Android.

I remember encountering this issue and making a fix for it on my fork of this plugin.

Check it out on: https://github.com/xmarkclx/cordova-plugin-photo-library-sism

xmarkclx avatar Oct 14 '19 13:10 xmarkclx

Hi @xmarkclx it does not work better with your version. Have you tried it on Android 10 ? Seems like they changed the way and places where we are authorized to write media files. I'm planning on doing my own fork.

roxteddy avatar Oct 16 '19 11:10 roxteddy

The easy way would be to add the android:requestLegacyExternalStorage="true" entry to the manifest thru the plugin config.

https://developer.android.com/training/data-storage/files/external-scoped#opt-out-of-scoped-storage

And after that it will ask to completely rework the way we write media files but I miss time for now :S

roxteddy avatar Oct 21 '19 15:10 roxteddy

android:requestLegacyExternalStorage

Hi @roxteddy , have you come across this error msg after adding _android:requestLegacyExternalStorage="true"_

~/platforms/android/app/build/intermediates/merged_manifests/debug/AndroidManifest.xml:35: AAPT: error: attribute android:requestLegacyExternalStorage not found.

I got this error after i put the following into my config.xml file in ionic project. <edit-config file="AndroidManifest.xml" mode="merge" target="/manifest/application" xmlns:android="http://schemas.android.com/apk/res/android"> <application android:requestLegacyExternalStorage="false" /> </edit-config>

mingyiyangyarris avatar Oct 22 '19 06:10 mingyiyangyarris

android:requestLegacyExternalStorage

Hi @roxteddy , have you come across this error msg after adding _android:requestLegacyExternalStorage="true"_

~/platforms/android/app/build/intermediates/merged_manifests/debug/AndroidManifest.xml:35: AAPT: error: attribute android:requestLegacyExternalStorage not found.

I got this error after i put the following into my config.xml file in ionic project. <edit-config file="AndroidManifest.xml" mode="merge" target="/manifest/application" xmlns:android="http://schemas.android.com/apk/res/android"> <application android:requestLegacyExternalStorage="false" /> </edit-config>

Hi @mingyiyangyarris , after adding android:requestLegacyExternalStorage="true" i am getting the same error which you got. Did you find any solution?

codehack26 avatar Aug 04 '20 14:08 codehack26

Any news about that?

fgarcia5 avatar Oct 20 '20 00:10 fgarcia5

android:requestLegacyExternalStorage

Hi @roxteddy , have you come across this error msg after adding _android:requestLegacyExternalStorage="true"_

~/platforms/android/app/build/intermediates/merged_manifests/debug/AndroidManifest.xml:35: AAPT: error: attribute android:requestLegacyExternalStorage not found.

I got this error after i put the following into my config.xml file in ionic project. <edit-config file="AndroidManifest.xml" mode="merge" target="/manifest/application" xmlns:android="http://schemas.android.com/apk/res/android"> <application android:requestLegacyExternalStorage="false" /> </edit-config>

Hi @mingyiyangyarris , after adding android:requestLegacyExternalStorage="true" i am getting the same error which you got. Did you find any solution?

I am also getting this error. Have anyone found a fix?

kjetil-pbl avatar Oct 20 '20 09:10 kjetil-pbl

AndroidManifest.xml

<application android:requestLegacyExternalStorage="true"

is work

gofunbox avatar Aug 11 '21 08:08 gofunbox

I think you get that error because of your compilation API version. Anyway, LegacyExternalStorage is not a solution since we will be forced to use latest API target by september for new apps and november for all aps and they removed this legacy option. we have to find a new solution to save files. Possibly using the Android Media library.

roxteddy avatar Aug 11 '21 08:08 roxteddy