cordova-plugin-file icon indicating copy to clipboard operation
cordova-plugin-file copied to clipboard

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

Open rolinger opened this issue 9 months ago • 4 comments
trafficstars

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?

rolinger avatar Jan 30 '25 15:01 rolinger