Skip to content

Cordova 11 Android throwing FileError Code 12 trying to access fileSystem #560

Open
@rolinger

Description

@rolinger

Bug Report

Trying to write to localStorage is breaking on Android with Cordova 11.1.0 (cordova-android 11)

Problem

I am using plugin cordova-plugin-file-downloader which is essentially a wrapper for other various plugins. My app code worked on Cordova 10 but is now breaking on Cordova 11. I tracked everything down to a FileError Code 12 which implies the system/folder I am trying to write to doesn't exist, can't be created or doesn't have permission, and the error is being generated from this cordova-plugin-file plugin.

The cordova-plugin-file-downloader call is simply:

downloader.init({folder: 'CustomFolderName', fileSystem: 'file:///storage/emulated/0/'}) ;
   or the default fileSystem:
downloader.init({folder: 'CustomFolderName''}) ;

It fails to initialize and immediately throws the FileError code 12. In <= Cordova 10, this same code worked and on Android devices I could navigate to the devices general Documents folder, open the designated CustomFolderName folder and view the file. I looked at Cordova 10 cordova-plugin-file fileSystem specs and they look the same as cordova 11 fileSystem specs; this I think this is a bug. Or if it has changed, what should I be using now because I don't am not seeing any differences?

What is expected to happen?

Folder created and document written to that folder

What does actually happen?

FileError Code 12 is generated.

Information

Command or Code

Environment, Platform, Device

Windows 10, Android - all devices

Version information

[email protected]
cordova-android@11
[email protected]

Checklist

  • [x ] I searched for existing GitHub issues
  • [ x] I updated all Cordova tooling to most recent version
  • [x ] I included all the necessary information above

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions