Error in adding dependency for firebase-ui-auth:2.

2020-04-29 01:32发布

问题:

I'm facing this issue since yesterday... I am adding:

//Add Library
compile 'com.android.support:design:26.1.0'
compile 'com.firebaseui:firebase-ui:0.2.0'
compile 'com.google.android.gms:play-services-auth:11.2.2'
compile 'com.google.firebase:firebase-auth:11.2.2'

and the only code left for the app is:

compile 'com.firebaseui:firebase-ui-auth:2.3.0'

As soon as I'm adding this I'm getting an error:

Error:Execution failed for task ':app:processDebugManifest'. Manifest merger failed : Attribute meta-data#android.support.VERSION@value value=(26.1.0) from [com.android.support:design:26.1.0] AndroidManifest.xml:28:13-35 is also present at [com.android.support:customtabs:26.0.1] AndroidManifest.xml:25:13-35 value=(26.0.1). Suggestion: add 'tools:replace="android:value"' to element at AndroidManifest.xml:26:9-28:38 to override.

I've already tried compile 'com.firebaseui:firebase-ui-auth:1.2.0' but no use.

Need some help! Thanks in advance :)

回答1:

Check this link in the firebase UI readme:

If you would like to use a newer version of one of FirebaseUI's transitive dependencies, such as Firebase, Play services, or the Android support libraries, you need to add explicit compile declarations in your build.gradle for all of FirebaseUI's dependencies at the version you want to use.

For example if you want to use Play services/Firebase version FOO and support libraries version BAR add the following extra lines for each FirebaseUI module you're using:

Auth:

compile "com.google.firebase:firebase-auth:$FOO"
compile "com.google.android.gms:play-services-auth:$FOO"

compile "com.android.support:design:$BAR"
compile "com.android.support:customtabs:$BAR"
compile "com.android.support:cardview-v7:$BAR"

Then in your case you have to use:

compile "com.android.support:design:26.1.0"
compile "com.android.support:customtabs:26.1.0"
compile "com.android.support:cardview-v7:26.1.0"


回答2:

compile 'com.firebaseui:firebase-ui-auth:2.3.0'

When your FirebasuUi Version is 2.3.0, your Firebase/Play Services Version must be 11.0.4

Your Library

//Add Library
compile 'com.android.support:design:26.1.0' //--->Same to your buildToolVersion
compile 'com.firebaseui:firebase-ui:0.2.0'  //--->2.3.0
compile 'com.google.android.gms:play-services-auth:11.2.2' //--->11.0.4
compile 'com.google.firebase:firebase-auth:11.2.2' //--->11.0.4

Note

Until now, the latest buildToolVersion is 26.0.2 .



回答3:

I follow this suggestion:

Suggestion: add 'tools:replace="android:value"' to element at AndroidManifest.xml

So, adding this meta-data to my manifest resolve my problem:

<meta-data
    tools:replace="android:value"
    android:name="android.support.VERSION"
    android:value="26.1.0" />