chore(android): improve error message when Filesystem.copy fails #3148
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In my case, this failed on Android 10 due to not having
android:requestLegacyExternalStorage="true"
in
AndroidManifest.xml
. At least if there's a useful error message, it's a starting point for debugging.I noticed the documentation for the FileSystem plugin does mention this for the FileSystemDirectory.Documents
enum member, but actually this can also be required when copying a file produced by the Camera plugin into the Data
directory.
Presumably this was introduced when upgrading the target SDK version from 28 to 29, so it might be worth calling
out in the 2.0 upgrade notes here.
I'm also a little concerned about what I read about Android 10+. If Capacitor doesn't switch to using the Storage Access Framework, will copying photos from the camera stop working entirely at some point?
https://commonsware.com/blog/2019/06/07/death-external-storage-end-saga.html