Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error after adding Facebook login dependency in Android

I want to integrate my app with facebook login, but when adding below dependency and syncing Gradle:

implementation 'com.facebook.android:facebook-android-sdk:[5,6)'

I got the following errors:

ERROR: Failed to resolve: legacy-support-v4
Affected Modules: app


ERROR: Failed to resolve: browser
Affected Modules: app


ERROR: Failed to resolve: legacy-support-core-utils
Affected Modules: app


ERROR: Failed to resolve: media
Affected Modules: app

My build.gradle in app-level:

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

buildscript {
    repositories {
        maven { url 'https://plugins.gradle.org/m2/'}
    }
}

repositories { }

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.***************"
        minSdkVersion 21
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.google.firebase:firebase-analytics:17.2.1'
    implementation 'com.squareup.retrofit2:retrofit:2.5.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
    implementation 'com.github.GrenderG:Toasty:1.4.1'
    implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
    implementation 'com.gauravk.bubblenavigation:bubblenavigation:1.0.7'
    implementation 'com.tuyenmonkey:mkloader:1.4.0'
    implementation 'me.riddhimanadib.form-master:form-master:1.1.0'
    implementation 'com.facebook.android:facebook-android-sdk:[5,6)'

}

apply plugin: 'com.google.gms.google-services'

and build.gradle on project-level:

buildscript {
    repositories {
        google()
        jcenter()
        maven { url 'https://maven.fabric.io/public' }
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.3'
        classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.8.2'
        classpath 'com.google.gms:google-services:4.3.3'
        classpath 'io.fabric.tools:gradle:1.31.2'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven { url "https://www.jitpack.io" }
        mavenCentral()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

I've searched a lot on google and StackOverflow and tested all the methods, but this problem doesn't fix. Please help me where is my problem.

like image 824
Mohammadreza Yektamaram Avatar asked Jan 04 '20 13:01

Mohammadreza Yektamaram


People also ask

What does feature unavailable Facebook login is currently unavailable for this app mean?

If you see the message –> Feature unavailable: Facebook Login is currently unavailable for this app after clicking the Facebook login icon, it's due to Facebook's Data Use Checkup that Facebook introduced recently.


1 Answers

First of all remove

buildscript {
    repositories {
        maven { url 'https://plugins.gradle.org/m2/'}
    }
}

repositories { }

from your app-level Gradle file when you have repositories set in your project-level Gradle file. This causes confusion.

Use implementation 'com.facebook.android:facebook-android-sdk:5.13.0' instead of your dependency.

You can always check Maven Centeral for the latest version of libraries.

or

Use Gradle, please, just enter the library name you need and copy the result (don't forget to replace compile with implementation)

like image 118
feridok Avatar answered Sep 18 '22 01:09

feridok



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!