Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ionic4: Execution failed for task ':app:processDebugManifest'

I'm working on an ionic4 app with angular and firebase.

I was building the app to android using: ionic cordova run android, it was successfully built the application. Suddenly when I'm running the same command there is an error showing:

Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91 is also present at [androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory). Suggestion: add 'tools:replace="android:appComponentFactory"' to element at AndroidManifest.xml:5:5-37:19 to override.

I've tried to add tools:replace="android:appComponentFactory" to element at AndroidManifest.xml. And I've have tried also to delete the platforms/android and install it again without getting the result

Does anyone have any idea about what happening? or can anyone help me with this issue!

like image 511
Mustafa Shakaroun Avatar asked Jun 21 '19 11:06

Mustafa Shakaroun


2 Answers

I had a similar issue I think, and found out it was because of AndroidX plugins. Here is what worked for me :

ionic cordova plugin add cordova-plugin-androidx
ionic cordova plugin add cordova-plugin-androidx-adapter

Simply adding these plugins removed any build error.

Also, if you're still using the original firebase plugin you should replace it with one of the fixed forks : https://github.com/wizpanda/cordova-plugin-firebase-lib or https://github.com/dpa99c/cordova-plugin-firebase

And cordova clean android then rebuild.

Note that you also need Android SDK 28 for it to work, and I recommend updating Cordova and ionic as well.

like image 134
Jeremy Belolo Avatar answered Nov 16 '22 06:11

Jeremy Belolo


After spending number of hours on this issue finally found the solution. This build failure is due to a Major version release of the Google Play Services and Firebase on 17/06/2019

ionic cordova platform rm android
ionic cordova platform add [email protected] 
ionic cordova plugin add cordova-plugin-androidx 
ionic cordova plugin add cordova-plugin-androidx-adapter

Note: This will resolve your issue

Note: If you are using cordova-plugin-firebase and encountering errors, you can use this plugin which is published as cordova-plugin-firebasex and is fixed to resolve issues caused by the new Firebase SDK:

rm -Rf platforms/android
cordova plugin rm cordova-plugin-firebase
rm -Rf plugins/ node_modules/
npm install
cordova plugin add cordova-plugin-firebasex
cordova platform add android

I hope this will help.

cheers!

like image 5
Manvender Singh Rathore Avatar answered Nov 16 '22 05:11

Manvender Singh Rathore