Wai Yan Hein
Wai Yan Hein

Reputation: 14771

Cannot install Facebook Android SDK using Gradle in Android Studio

I am developing an Android app. In my app, I need to integrate with Facebook. So I am installing SDK using Gradle following this link. But when I run my app to update Gradle, it is throwing error. How can I fix it to install sdk?

This is my Gradle file:

 apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

defaultConfig {
    applicationId "com.blog.waiyanhein.mmfashion.facebooksdk.facebooksdk"
    minSdkVersion 16
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

repositories {
    mavenCentral()
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:design:23.1.1'
    compile 'com.facebook.android:facebook-android-sdk:4.+'
}

This is the screenshots of error message:

enter image description here

enter image description here

Why I cannot install it? I am using Android Studio version 1.4. How can I install Facebook SDK using Gradle in Android Studio? I exactly followed the instructions from Facebook.

Upvotes: 1

Views: 156

Answers (1)

Emmanuel Montt
Emmanuel Montt

Reputation: 376

you forgot other libraries in your gradle.

try to use

compile "com.android.support:design:23.2.1"
compile 'com.android.support:support-v4:23.2.1'
compile 'com.android.support:support-v13:23.2.1'
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:cardview-v7:23.2.1'
compile 'com.android.support:recyclerview-v7:23.2.1'

Upvotes: 1

Related Questions