How to set up Android Studio to build Facebook SDK?

152 Views Asked by At

I loaded the SDK via git. After that I imported it in Android Studio.

When I call ./gradlew clean facebook:assemble I get a lot of cannot find symbol error messages.

Gradle can't find classes from the android-support lib and it can't find the R class too. But at the end the build finishes successful.

Are this error messages okay or do if have to fix something?

Android Studio shows this errors too. How can I fix this?

2

There are 2 best solutions below

0
On

The described problem was fixed with this commit.

3
On

You can add the Facebook SDK via a gradle dependency.

compile 'com.facebook.android:facebook-android-sdk:4.2.0'

If you want to add the SDK as a module in Android Studio then the following should work:

Add the FacebookSDK to your project, at the same level as your 'app' directory.

Then you need to edit settings.grade and app/build.gradle

settings.grade

include ':FacebookSDK', ':app' // FacebookSDK needs to be first

app/build.gradle

compile project(':FacebookSDK')