Include Facebook SDK via Gradle

The problem is that current FB SDK uses Gradle only. If I’m trying to use it as JAR dependency in .vcproj settings - it can’t import com.facebook.(…) in Java or can’t find classes via JNI.
I tried to use settings.gradle for it and stuck:

include ":facebook"
project(":facebook").projectDir = file("../../../android/facebook-4.3.0")

I got this message:

FAILURE: Build failed with an exception.
  
  * What went wrong:
  No projects in this build have build file 'D:\...\Debug\Android\build\nsight_tegra_build.gradle'.

I’m still trying to solve it via --init-script option, but I think that you guys should create feature which will allow to programmer to use his own ‘build.gradle’ file.

upd:
I’m trying something like this in init.gradle:

import com.facebook.android.*;

initscript
{
	allprojects
	{
		buildscript
		{
			repositories
			{
				def androidHome = System.getenv("ANDROID_HOME")
				mavenCentral()
				maven
				{
					url "$androidHome/extras/android/m2repository/"
				}
			}

			dependencies
			{
				classpath group: 'com.facebook.android', name: 'facebook-android-sdk', version: '4.3.0'
			}
		}
	}
}

rootProject
{
	buildscript
	{
		repositories
		{
			def androidHome = System.getenv("ANDROID_HOME")
			mavenCentral()
			maven
			{
				url "$androidHome/extras/android/m2repository/"
			}
		}

		dependencies
		{
			classpath group: 'com.facebook.android', name: 'facebook-android-sdk', version: '4.3.0'
		}
	}
}

But, as I understand, all what was defined in “buildscript” section is local always.

Extending Gradle builds will be possible in the next release. Sorry for the inconvenience!

Now that AndroidWorks1R2 is out, is there a solution to this problem? How do we include the Facebook SDK in our project?

Create nsight_tegra_build_overrides.gradle in your project’s android root folder:

copy
{
	from "$System.env.ANDROID_HOME/extras/google/play_billing/IInAppBillingService.aidl"
	into "aidl/com/android/vending/billing"
}

android
{
	repositories
	{
		mavenCentral()
	}

	sourceSets.main
	{
		aidl.srcDirs += ['aidl']
	}
}

def googlePlayVersion = '7.5.0'

dependencies
{
	compile 'com.facebook.android:facebook-android-sdk:4.3.0'
	compile 'com.google.android.gms:play-services-games:' + googlePlayVersion
	compile 'com.google.android.gms:play-services-ads:' + googlePlayVersion
}

You should remove Google Play Services from this example if you don’t use it:

android
{
	repositories
	{
		mavenCentral()
	}
}

dependencies
{
	compile 'com.facebook.android:facebook-android-sdk:4.3.0'
}

That’s all!