'ANDROID_BUILD_SDK_VERSION' Error with Facebook SDK

11,059

Solution 1

You have this error because you did not replace 'ANDROID_BUILD_SDK_VERSION' by 20 in HelloFacebookSample/build.gradle, not in Facebook/build.gradle.

Solution 2

Facebook's "build.gradle" file assumes that you have a "gradle.properties" file where the ANDROID_BUILD_SDK_VERSION variable is declared. So all you have to do is create a file called "gradle.properties" in the root level and add the following to it.

ANDROID_BUILD_TARGET_SDK_VERSION=19 ANDROID_BUILD_TOOLS_VERSION=10.0.0 ANDROID_BUILD_SDK_VERSION=19 ANDROID_BUILD_MIN_SDK_VERSION=11

Solution 3

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.

  1. 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

  1. 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
  1. 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.

Share:
11,059
user3289740
Author by

user3289740

Updated on June 04, 2022

Comments

  • user3289740
    user3289740 almost 2 years

    I'm consistenly getting the same error on HelloFacebookSample when importing Facebook SDK.

    Error:(8, 0) Could not find property 'ANDROID_BUILD_SDK_VERSION' on project ':HelloFacebookSample'.

    I know the error is regarding the HelloFacebookSample, and I've tried to assign 'ANDROID_BUILD_SDK_VERSION' = 20 (MY SDK VERSION). It still shoots the same error.

    Here is a snapshot

    enter image description here

    This error is sucking the life out of me. How can I get rid of this error?

  • user3289740
    user3289740 over 9 years
    THANK YOU SO MUCH! It was so simple!