Working on a React Native project but out of sudden it stopped working & started giving an error:
Manifest merger failed : Attribute application@appCompo
You can lock down your googleservices and firebase versions to avoid androidX.
In android/build.gradle add:
buildscript {
...
ext {
// Lock down googlePlayServicesVersion
googlePlayServicesVersion = "16.1.0"
firebaseVersion = "17.6.0"
}
}
OR in gradle.properties add:
googlePlayServicesVersion=16.1.0
firebaseVersion=17.6.0
Probably post your app level gradle file here. Ideally if you are using some other dependency which is the updated/latest one then you would get this error.
If any of the dependency is the latest/updated one please downgrade it to the lesser version from checking the change logs from it's github. For me the culprit was stripe version which was internally using the androidx and was getting this error. i downgraded it and boom! It's gone :)
And also disable the androidx from gradle.properties
file using
android.useAndroidX=false
android.enableJetifier=false
Which forces the androidx to be disabled.
You mention you are using react-native. As mentioned elsewhere you cannot avoid AndroidX for ever though you may postpone it.
In react-native particularly it was difficult to convert because gradle does not jetify source files except for during the original refactor via Android Studio, and react-native ships it's native code as source files.
Now you may simply use the 'jetifier' tool though, and after installing it and running it the first time add npx jetify
in the postinstall of your package.json for persistent jetification across node module installs/updates.
Then you should be able to successfully convert your app to AndroidX, start depending on new AndroidX library versions but still use libraries that have not converted. You will be better prepared for react-native 0.60 which will be AndroidX
If you must postpone AndroidX and are using react-native, for react-native 0.59 at least, you may also use the jetifier tool in reverse to modify source references in node_modules from androidx to the compat references.
Is there any possible way to keep using Support Library class rather than shifting to AndroidX class?
Yes it is possible, but you can only postpone this event.
You can't avoid it.
The new Firebase libraries and the new Google Play Libraries require androidx (check the lists below)
In a short time other third libraries will use these dependencies.
How to fix this issue?
You can only use the last versions of firebase/google play services/third libraries that work with support libraries v.28 or below.
Here the list of firebase and google play services libraries which started to work with the dependency of androidx.
Firebase:
Ads version 18.0.0
Analytics version 17.0.0
App Indexing version 19.0.0
Authentication version 18.0.0
Cloud Firestore version 20.0.0
Cloud Firestore-ktx version 20.0.0
Cloud Functions (client) version 18.0.0
Cloud Messaging version 19.0.0
Cloud Storage version 18.0.0
Dynamic Links version 18.0.0
In-App Messaging version 18.0.0
In-App Messaging Display version 18.0.0
Instance IDs version 19.0.0
ML Kit Common version 20.0.0
ML Kit Vision version 21.0.0
ML Kit Image Labeling Model version 18.0.0
ML Kit Face Detection Model version 18.0.0
ML Kit Object Detection and Tracking Model version 17.0.0
ML Kit Vision AutoML version 17.0.0
ML Kit Natural Language version 20.0.0
ML Kit Language Identification Model version 20.0.0
ML Kit Smart Reply Model version 20.0.0
ML Kit Translate Model version 20.0.0
ML Kit Model Interpreter version 20.0.0
Realtime Database version 18.0.0
Performance Monitoring version 18.0.0
Remote Config version 18.0.0
A/B Testing version 18.0.0
Play services libraries:
com.google.android.datatransport:transport-api:2.0.0
com.google.android.datatransport:transport-backend-cct:2.0.0
com.google.android.datatransport:transport-runtime:2.0.0
com.google.android.gms:play-services-ads:18.0.0
com.google.android.gms:play-services-ads-identifier:17.0.0
com.google.android.gms:play-services-ads-lite:18.0.0
com.google.android.gms:play-services-afs-native:17.0.0
com.google.android.gms:play-services-analytics:17.0.0
com.google.android.gms:play-services-analytics-impl:17.0.0
com.google.android.gms:play-services-appinvite:18.0.0
com.google.android.gms:play-services-audience:17.0.0
com.google.android.gms:play-services-auth:17.0.0
com.google.android.gms:play-services-auth-api-phone:17.0.0
com.google.android.gms:play-services-awareness:17.0.0
com.google.android.gms:play-services-base:17.0.0
com.google.android.gms:play-services-basement:17.0.0
com.google.android.gms:play-services-cast:17.0.0
com.google.android.gms:play-services-cast-framework:17.0.0
com.google.android.gms:play-services-clearcut:17.0.0
com.google.android.gms:play-services-cronet:17.0.0
com.google.android.gms:play-services-drive:17.0.0
com.google.android.gms:play-services-fido:18.0.0
com.google.android.gms:play-services-fitness:17.0.0
com.google.android.gms:play-services-flags:17.0.0
com.google.android.gms:play-services-games:18.0.0
com.google.android.gms:play-services-gass:18.0.0
com.google.android.gms:play-services-gcm:17.0.0
com.google.android.gms:play-services-identity:17.0.0
com.google.android.gms:play-services-iid:17.0.0
com.google.android.gms:play-services-instantapps:17.0.0
com.google.android.gms:play-services-location:17.0.0
com.google.android.gms:play-services-maps:17.0.0
com.google.android.gms:play-services-measurement:17.0.0
com.google.android.gms:play-services-measurement-api:17.0.0
com.google.android.gms:play-services-measurement-impl:17.0.0
com.google.android.gms:play-services-measurement-sdk:17.0.0
com.google.android.gms:play-services-measurement-sdk-api:17.0.0
com.google.android.gms:play-services-nearby:17.0.0
com.google.android.gms:play-services-oss-licenses:17.0.0
com.google.android.gms:play-services-panorama:17.0.0
com.google.android.gms:play-services-phenotype:17.0.0
com.google.android.gms:play-services-places:17.0.0
com.google.android.gms:play-services-places-placereport:17.0.0
com.google.android.gms:play-services-plus:17.0.0
com.google.android.gms:play-services-safetynet:17.0.0
com.google.android.gms:play-services-stats:17.0.0
com.google.android.gms:play-services-tagmanager:17.0.0
com.google.android.gms:play-services-tagmanager-api:17.0.0
com.google.android.gms:play-services-tagmanager-v4-impl:17.0.0
com.google.android.gms:play-services-tasks:17.0.0
com.google.android.gms:play-services-vision:18.0.0
com.google.android.gms:play-services-vision-common:18.0.0
com.google.android.gms:play-services-vision-image-label:18.0.0
com.google.android.gms:play-services-wallet:17.0.0
com.google.android.gms:play-services-wearable:17.0.0
According from Dan Lew
The support library artifacts are being deprecated and all future development is going into AndroidX, so there's no avoiding this migration. Hopefully, though, these tips will give you a clearer transition path.