Seeing that the above answers might be outdated by now, I'm posting this updated solution. I spent two hours on it and finally got it to work.
I'm using Android Studios 1.1 with Facebook SDK 4.0.
Before you open Android Studios, go to \facebook-android-sdk-4.0.1\facebook\build.gradle and replace the task javadoc(type: Javadoc):
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
with this:
task androidJavadocs(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
ext.androidJar = "${android.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar"
classpath += files(ext.androidJar)
}
Above is from Cannot call getBootClasspath() before setTargetInfo() is called courtesy of: Mansukh Ahir
- Now navigate to the root of your Facebook SDK folder on your PC:\facebook-android-sdk-4.0.1 and create a gradle.properties file and say this within it or customise it according to your SDK version that you have already on your PC:
ANDROID_BUILD_MIN_SDK_VERSION=15
ANDROID_BUILD_TARGET_SDK_VERSION=21
ANDROID_BUILD_TOOLS_VERSION=21.1.2
ANDROID_BUILD_SDK_VERSION=21
- Now go to Android Studios and import your samples folder into the Android Studios \facebook-android-sdk-4.0.1\samples
Android Studios should now import everything. You will still experience some errors during the import as some of the samples, such as the MessengerSendSample, have build.gradle files that point to minimum SDK version of 14 instead of 15 as defined in your gradle.properties file. Just open the MessengerSendSample build.gradle and change to 15 and it should work.