Our Ionic 5 app uses the Cordova fileOpener2 plugin to open up files that the user has downloaded on to their the device (pdf’s, images, docs etc) - I’m not aware of a Capacitor alternative so we are still having to use the Cordova plugin for this - is there an alternative?
When I build locally the app builds ok but when I build on AppFlow the build fails with the error
android.support.v4.content does not exist against the FileOpener2 plugin.
This appears to be because Capacitor 2 uses Android X for its support library dependencies.
The ionic docs suggest adding jetifier and running npx jetify so I have installed it and added the following to the package.json scripts section:
"postinstall": "npx jetify"
Unfortunately the builds still fail on AppFlow with an error of:
npm WARN lifecycle myApp@2.9.9~postinstall: cannot run in wd myApp@2.9.9 npx jetify (wd=/builds/myName/myApp)
I then noticed that the documentation for the fileOpener2 plugin suggests adding the following two plugins if your project uses Android X and that the problem should then go away:
However when I add these and try to build on AppFlow I get a failure with the original error again:
android.support.v4.content does not exist
Has anyone else had similar issues and found a solution?
I have a few questions really:
- Is there any capacitor alternative to the FileOpener2 plugin?
- Why do my local builds work when the AppFlow builds are failing?
- What is the preferred solution to getting round this issue - the jetifiy solution or the addition of the two Cordova plugins (not that either has worked for me)