Home » Android » Android manifest merger with facebook and firebase libraries

Android manifest merger with facebook and firebase libraries

Posted by: admin June 15, 2020 Leave a comment

Questions:

I’ve imported in my project 2 libraries (in gradle file):

...
/* Firebase UI */
compile 'com.firebaseui:firebase-ui:0.4.0'

/* Facebook login */
compile 'com.facebook.android:facebook-android-sdk:4.13.0'

but when building my project I have the following error:

D:\Android\Projects\quoter\app\src\main\AndroidManifest.xml:68:13-58
Error: Attribute activity#[email protected]
value=(@style/FirebaseUI.Translucent) from
[com.firebaseui:firebase-ui-auth:0.4.0] AndroidManifest.xml:68:13-58
is also present at [com.facebook.android:facebook-android-sdk:4.13.0] AndroidManifest.xml:32:13-72
value=(@android:style/Theme.Translucent.NoTitleBar). Suggestion: add
‘tools:replace=”android:theme”‘ to element at
AndroidManifest.xml:64:9-68:61 to override.

I found the expanded jars with the manifest files for both Facebook sdk and Firebase UI libraries, but I’m not sure that changing them it’s the right way to solve this error because each time I clean and re-build my project new manifests are also generated…

How can i solve this error? It seems to me an incopatibility between the 2 libraries…

Note: adding in my app manifest the following

<application
    tools:node="replace"

solve this problem, but it’s impossible to launch the app because Firebase it’s not correctly initialized (see https://stackoverflow.com/a/38060272/6503817)

How to&Answers:

FirebaseUI already compiles Facebook for you, so when you try to sync it basically throws the error because you are trying to compile the same thing twice.

Remove compile 'com.facebook.android:facebook-android-sdk:4.13.0' and keep: compile 'com.firebaseui:firebase-ui:0.4.0'

and you are done!

Don’t worry! You will still have Facebook Login

Answer:

Unfortunately, “tools:replace” didn’t work for me, but a GitHub issue in the Firebase UI has a solution https://github.com/firebase/FirebaseUI-Android/issues/230

But FirebaseUI already depends on version 4.11.0 of the SDK. Can you try removing your Facebook dependency and just relying on the transitive dependency brought in by FirebaseUI?

Answer:

I would recommend you go through the documentation once, provided FirebaseUI Android and FirebaseUI Auth Android. They are pretty thorough and most likely will curb your doubts.