apache / cordova-plugin-file

Apache Cordova File Plugin
https://cordova.apache.org/
Apache License 2.0
740 stars 757 forks source link

cordova-plugin-file 8.0.0 doesn'work with android 11.0.0 #584

Closed FranGhe closed 10 months ago

FranGhe commented 10 months ago

First of all, sorry if my english it's not so good...

I developed my app with:

At the end of my development I decided to update the plugins and platform... and surprise... cordova-plugin-file 8.0.0 doesn'work with android 11.0.0

To update them I deleted the platform and then the plugin ... I first inserted the plugin and then the platform and during the installation of the plugin for the platform this message appears: "Plugin doesn't support this project's cordova-android version. cordova-android 11.0.0. failed version requirement: Skipping 'cordova-plugin-file' for android."

If I start with cordova run my app crash with message :"Cannot read properties of undefined (reading 'dataDirectory')"

Following some suggestions I changed <preference name="AndroidPersistentFileLocation" value="Internal" /> with <preference name="AndroidPersistentFileLocation" value="Compatibility" /> but nothing changes.

I reinstalled cordova-plugin-file 7.0.0 and I have a waning message like this: The android persistent storage location now defaults to "Internal. Please check this plugin's README to see if your application needs any changes in the config.xml If this is a new application no changes are required. If this is an update to an existing application that did not specify an "AndroidPersistentFileLocation" you may need to add to file config.xml in order for application to find previousely stored files. ... but everything works.

Do you have any suggestions?

EYALIN commented 10 months ago

@FranGhe why you are not upgrading to cordova 12? in 31.8 you will need to upgrade your project to SDK 33, which i don't think will be supported in cordova 11

breautek commented 10 months ago

"Plugin doesn't support this project's cordova-android version. cordova-android 11.0.0. failed version requirement: Skipping 'cordova-plugin-file' for android."

v8 requires cordova-android@12 because cordova-android 12 builds with API 33 which this plugin uses.

The android persistent storage location now defaults to "Internal. Please check this plugin's README to see if your application needs any changes in the config.xml If this is a new application no changes are required. If this is an update to an existing application that did not specify an "AndroidPersistentFileLocation" you may need to add to file config.xml in order for application to find previousely stored files.

This is a warning message is more of a notice and only really applies if you have an app that nearly 10 years old. If you had an app that used v2 of this plugin, v3+ required <preference name="AndroidPersistentFileLocation" value="Compatibility" /> to maintain access to stored files. However if you never used <preference name="AndroidPersistentFileLocation" value="Compatibility" /> or you're building a new app, then you should just use the default and it's safe to ignore the message.

If you need to stay on on cordova-android@11, the you'll need to continue using file plugin 7.

Closing as not a bug.

ganesh-sa commented 9 months ago

@breautek The same error comes when installing plugin 7 also, for cordova-android 11. Cordova skips plugin installation.