Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why can't I import the facebook SDK correctly?

I added correctly as a dependency and put the central maven repository as, there is no error in the import! But I can't access any method as the AppEventsLogger only says to create the class and NOT import. I'm following in the footsteps of Facebook Quick Starts.

build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"

    defaultConfig {
        applicationId "com.morais.daniela.doctorquiz"
        minSdkVersion 14
        targetSdkVersion 21
        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.0.0'
    compile 'com.android.support:support-v4:22.0.0'
    compile 'com.facebook.android:facebook-android-sdk:4.0.0'
}

log

16:59:02 Gradle build finished in 52 sec
like image 935
Daniela Morais Avatar asked Apr 18 '15 20:04

Daniela Morais


People also ask

How can I update my Facebook SDK?

Login into Facebook and navigate to https://developers.facebook.com/apps/ Select the App you want to upgrade (you might have access to multiple apps) Click Settings > Advanced. Select the latest version under the Upgrade API Version section for both “Upgrade All Calls” and “Upgrade Calls for App Roles”

On which platforms does the Facebook SDK work on?

Facebook iOS SDK. Facebook Android SDK. Facebook SDK for Unity SDK.


1 Answers

You need to either import com.facebook.appevents.AppEventsLogger or use the fully qualified class name in your code.

com.facebook.appevents.AppEventsLogger logger;

If you don't do this there is no way of knowing what your refering to.

like image 197
dlismore Avatar answered Sep 18 '22 13:09

dlismore