androidfacebook-sdk-4.xandroid-studio-import

Unable to import 'facebook' sdk 4.9.0 as module in android studio 1.2


I get 'Specify location of the gradle or android eclipse project'. I followed the following steps:

1) Added mavenCentral and dependency in app->build.gradle as

 apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    defaultConfig {
        applicationId "com.example.akshitag.cooltrends"
        minSdkVersion 15
        targetSdkVersion 22
        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'])
    compile 'com.android.support:appcompat-v7:22.1.1'
    compile 'com.facebook.android:facebook-android-sdk:4.+'
}

2) Build the project which is successful.

3) Download and Unzip facebook sdk. Use Import Module under File->New and select facebook folder. Inside the unzipeed older, I have this: \facebook-android-sdk-4.9.0\facebook-android-sdk-4.9.0. It contains AudienceNetwork and facebook folder. Inside facebook folder, I have following files: sample, facebook-android-sdk-4.9.0.aar, licence.txt and notice.txt

I get the following error

Also, this is how my project structure looks like. enter image description here

Could anyone guide me here please?


Solution

  • You already compiled sdk in gradle then why you want to add it again using different method ? Your project is done, you don't need to add it as a separate module.