MohammadAli
MohammadAli

Reputation: 3446

Add facebook dependency gradle error

I add below dependency for login with facebook then error can show me.

implementation 'com.facebook.android:facebook-login:[4,5)'

Below Error show me :

All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 27.1.1, 27.0.2. Examples include com.android.support:animated-vector-drawable:27.1.1 and com.android.support:customtabs:27.0.2 less... (Ctrl+F1) There are some combinations of libraries, or tools and libraries, that are incompatible, or can lead to bugs. One such incompatibility is compiling with a version of the Android support libraries that is not the latest version (or in particular, a version lower than your targetSdkVersion).

Gradle.build(app):

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'
    implementation 'com.android.support:support-v4:27.1.1'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

    implementation 'com.android.support:design:27.1.1'
    implementation 'com.android.support:cardview-v7:27.1.+'
    implementation 'com.android.support:recyclerview-v7:27.1.+'

    implementation 'com.github.bumptech.glide:glide:4.3.1'

    //Volley
    implementation 'com.android.volley:volley:1.0.0'

    //facebook
    implementation 'com.facebook.android:facebook-login:[4,5)'

    implementation 'de.hdodenhof:circleimageview:2.2.0'

    implementation 'com.intuit.ssp:ssp-android:1.0.5'
    implementation 'com.intuit.sdp:sdp-android:1.0.5'

    implementation 'com.ramotion.foldingcell:folding-cell:1.2.2'

    implementation 'com.google.android.gms:play-services-maps:15.0.1'


    implementation project(':revealfab')
}

Upvotes: 2

Views: 532

Answers (4)

vijay maddhesiya
vijay maddhesiya

Reputation: 48

First, add below codes in Gradle of project-level:

ext {

    supportLibraryVersion = "27.1.1"

}

After that, add in Gradle of app-level:

1- Add same library version

2- Add following codes:

compile "com.android.support:appcompat-v7:$rootProject.supportLibraryVersion"
    compile "com.android.support:design:$rootProject.supportLibraryVersion"
    compile "com.android.support:cardview-v7:$rootProject.supportLibraryVersion"

compile 'com.facebook.android:facebook-android-sdk:[4,5)'

Upvotes: 0

Shubham Sejpal
Shubham Sejpal

Reputation: 3614

Try this it may helps you

// Facebook Login only
implementation 'com.facebook.android:facebook-login:4.+'

Upvotes: 0

IntelliJ Amiya
IntelliJ Amiya

Reputation: 75778

Don't

implementation 'com.facebook.android:facebook-login:[4,5)'

One such incompatibility is compiling with a version of the Android support libraries that is not the latest version (or in particular, a version lower than your targetSdkVersion.

You should try with

implementation 'com.facebook.android:facebook-android-sdk:4.33.0' //4.35.0

For more details, visit Facebook SDK

FYI

Use the proper version.

    implementation 'com.android.support:design:27.1.1'
    implementation 'com.android.support:cardview-v7:27.1.1'
    implementation 'com.android.support:recyclerview-v7:27.1.1'

Make sure, added

allprojects {
    repositories {
        google()
        jcenter()

    }
}

Upvotes: 1

Vikasdeep Singh
Vikasdeep Singh

Reputation: 21756

As error is clearly mentioned that mixing lib versions is not a good idea (mixing versions can lead to runtime crashes), so don't that. Here you are using 7:27.1.1 and 7:27.1.+. So keep the same version for all libs.

Instead of:

implementation 'com.facebook.android:facebook-login:[4,5)' // this is wrong
implementation 'com.android.support:cardview-v7:27.1.+'
implementation 'com.android.support:recyclerview-v7:27.1.+'

Use:

implementation 'com.facebook.android:facebook-login:4.35.0' //latest version and correct correct way
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'

Upvotes: 1

Related Questions