This issue occurs when some plugins of Cordova are installed in the ionic capacitor app.
And there are missing gradle dependency in the build.gradle of capacitor-cordova-android-plugins
So to fix this, this detail should always be put in the build.gradle immediatetly after every re-build and sync to and android
Once you have done:
ng build
ionic capacitor sync android
Then go to the build.gradle file of capacitor-cordova-android-plugins and add the dependency inside it every time
****************************************
fix: add missing gradle dependency for androidx.appcompat
in the section of “ext” add this line.
ext {
…
androidxAppCompatVersion = project.hasProperty(‘androidxAppCompatVersion‘) ? rootProject.ext.androidxAppCompatVersion : ‘1.2.0‘
….
}
Then inĀ the section of the “dependencies {” add the following line
dependencies {
…..
implementation “androidx.appcompat:appcompat:$androidxAppCompatVersion“
….
}
************************************
The two lines above should always be done after every rebuild