Hey everyone,
Currently I am using the ionic file plugin in capacitor. When I want to build this app I keep getting the following errors:
error: package android.support.v4.content does not exist
public class FileProvider extends android.support.v4.content.FileProvider {}
Can anyone help me?
Capacitor 2.x uses AndroidX so I guess any plugin that uses the older Android support libraries won’t work.
Which plugin are you using exactly? The Ionic Native one? Are you aware that there’s a Filesystem API that comes with Capacitor?
Hi! Same error, when I try to build for Android with Ionic Package:
/android/capacitor-cordova-android-plugins/src/main/java/org/apache/cordova/camera/CameraLauncher.java:40: error: package android.support.v4.content does not exist
import android.support.v4.content.FileProvider;
I saw it’s because Camera plugin uses AndroidX, but I am not able to find how to fix the issue!
What should I do?
Thanks!
I use “jetifier” for this on building my node_modules. To rebuild I remove the node_modules directory then run “npm i” to reinstall and jetifer will run after its complete and fixes those references.
Then in my package.json:
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"lint": "ng lint",
"postinstall": "jetifier"
}
I solved the following with
npm install -D jetifier
package.json ( changes )
change line
“build”: “ng build”
change to
“build”: “npx jetifier && ng build”
NOTE:
“postinstall”:“npx jetifier”
DOES NOT WORK IN APPFLOW ATM ( 10/23/2020 )
5 Likes