I\'m currently working on an ionic4 application, but recently it stopped working while building the application on an android reall device after adding https://ionicframewor
In my case, I removed this implementation under dependencies section in app level build.gradle file -
implementation 'com.google.android.gms:play-services-ads:19.2.0'
Remove or comment it out!!
For me, just installing the plugins "cordova-plugin-androidx" and "cordova-plugin-androidx-adapter" solved this problem:
$ ionic cordova plugin add cordova-plugin-androidx
$ ionic cordova plugin add cordova-plugin-androidx-adapter
I had this issue when I migrated to Androidx using the Android Studio feature but at the first time the migration was not successful so each time I tried to compile I ran into this issue.
To resolve this issue, I did the following:
[1] Comment all androidx dependencies in the app bundle.gradle file
[2] Try the Migrate to Androidx. You can see this link in Refactor -> Migrate to Androidx. If the migration was successful, then
[3] Uncomment all androidx dependencies in the app bundle.gradle file
You may clean and build your project again, hopefully this error should disappear.
Your project (or one of its sub-projects) is referring to a dependency using the + plus-sign at its end, like com.google.firebase:firebase-auth:+
, which means, use any higher version when possible, and that newer version is no longer using android.support
libraries and instead is using androidx
; to fix this issue follow the below steps.
ANDROID_HOME
environment-variable is set, and then, open a console window (like git-bash, because it keeps the whole command output), and cd
into your android
directory (for Ionic projects it should be platforms/android
)../gradlew :app:dependencies
androidx
.16.0.8 -> 19.0.0
or + -> 19.0.0
, which both mean that the version was auto-resolved (to something higher than specified by you because of +).clear
the console).To Force specific version of the dependencies add to your root build.gradle
something like below (which is what worked for me) but edit and add your own rules (if these do not work for you):
allprojects {
// ...
configurations.all {
resolutionStrategy {
force 'com.google.firebase:firebase-common:17.0.0'
force 'com.google.android.gms:play-services-basement:16.2.0'
force 'com.google.firebase:firebase-iid:16.0.0'
force 'com.google.firebase:firebase-auth:17.0.0'
}
}
}