Skip to content

Uncaught typeError: Wrong type for parameter "uri" of resolveLocalFileSystemURI #646

@rolinger

Description

@rolinger

On app startup, I am using the following code to check if an app directory exists and if not create it. It has worked fine forever - but on one users device I suddenly got the above error three times, once per each time the user started the app (within minutes of each other). This user is on Android 12, and has had my app on his device for about 3 months and had started it 17 times previously without the error, then on starts 18, 19 and 20 suddenly started generating this error:

Uncaught typeError: Wrong type for parameter "uri" of resolveLocalFileSystemURI

if (ionic.Platform.isAndroid()) {
      window.resolveLocalFileSystemURL(cordova.file.externalDataDirectory, function (directoryEntry) {
        directoryEntry.getDirectory("downloads", { create: true, exclusive: false}, 
          function(success) {
            errMgmt("ctrl/init",1004.5,"Android 'downloads' folder created") ;   
          },
          function(err) {
            errMgmt("ctrl/init",1004.6,"Android 'downloads' folder failed "+err) ;   
          }
        ) ;
      }) ;
    }

I have the following preferences set in my config.xml file:

    <preference name="AndroidPersistentFileLocation" value="Compatibility" />
    <preference name="AndroidExtraFilesystems" value="files,files-external,documents,sdcard,root" />

The user did not remove and reinstall the app at any point. Its from the original install several months ago, so what could cause this error to suddenly kick in?

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