Closed lincolnthree closed 4 years ago
can you provide a sample app or at least the Filesystem code you are using? what's the Android version of the device?
@jcesarmobile Thanks for the reply. I was actually just re-testing this since fixing the incomplete AndroidX migration you saw.
This is the code:
const result = Filesystem.writeFile({
path: filename,
data: 'data:application/pdf;base64,' + data,
directory,
encoding: FilesystemEncoding.UTF8
});
When FilesystemDirectory is FilesystemDirectory.Documents
, on Android 10 (Pixel 2XL), the crash occurs. It seems related to the fact that Documents is no longer available on 10. When I switch this toFilesystemDirectory.External
, everything works fine.
So I'd guess this is a problem with handling permission denied responses from the OS.
I can't reproduce on a new app. In my case, on Android 10 the plugin rejects with some errors when trying to use Documents folder, as expected since Documents folder is not accesible on Android 10.
Fair enough. Hopefully this helps anyone else who runs into it. Cheers.
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.
Bug Report
Capacitor Version
`lincoln$ npx cap doctor 💊 Capacitor Doctor 💊
Latest Dependencies:
@capacitor/cli: 2.0.1 @capacitor/core: 2.0.1 @capacitor/android: 2.0.1 @capacitor/electron: 2.0.1 @capacitor/ios: 2.0.1
Installed Dependencies:
@capacitor/cli 2.0.1 @capacitor/android 2.0.1 @capacitor/core 2.0.1 @capacitor/ios 2.0.1 @capacitor/electron 2.0.1
[success] Android looking great! 👌 :
Affected Platform(s)
Current Behavior
The app crashes when Filesystem permissions are requested by capacitor, upon calling the Filesystem API methods.
Expected Behavior
The app should wait for permissions without crashing.
Sample Code or Sample Application Repo
Call Filesystem.getDirectory() without prior filesystem permission grants.
Reproduction Steps
Call the FileSystem.getDirectory() method before permissions have been requested:
Other Technical Details
npm --version
output: 6.14.4node --version
output: v12.13.0pod --version
output (iOS issues only):Other Information