Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio 0.8.1 - how to use Facebook SDK?

I tried via import module but I'm always getting

Error:(13, 0) Could not find property 'ANDROID_BUILD_MIN_SDK_VERSION' on project ':facebook'. 

I didn't find a tutorial how to use the Facebook SDK with the latest Android Studio...

like image 703
swalkner Avatar asked Jun 28 '14 12:06

swalkner


People also ask

What is the use of Facebook SDK?

The Facebook SDK for Android gives you access to the following features: Facebook Login — A secure and convenient way for people to log into your app or website by using their Facebook credentials. Sharing — Enable people to post to Facebook from your app. People can share, send a message, and share to stories.


2 Answers

Using Facebook SDK 3.23 in Android Studio 1.1 preview 2

Two choices :

*Maven Repository for the Facebook SDK.

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

check for the latest version facebook sdk

OR

*Follow the steps below:

1.Download facebook sdk https://developers.facebook.com/docs/android/

2.Unzip the archive facebook-android-sdk-3.23.0

3.File menu->Import Module

4.Chose “facebook” folder inside the unzipped archive.

5.Go to directory facebook/build.gradle change this part

This:

 compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION)     buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION      defaultConfig {         minSdkVersion Integer.parseInt(project.ANDROID_BUILD_MIN_SDK_VERSION)         targetSdkVersion Integer.parseInt(project.ANDROID_BUILD_TARGET_SDK_VERSION)     } 

To proper sdk version

example:

 compileSdkVersion 21         buildToolsVersion '21.1.1'          defaultConfig {             minSdkVersion 14             targetSdkVersion 21         } 

6.Click your project and press F4 ,go to 'dependencies' tab, click '+', 'module dependency' and select your imported facebook module.

7.Resync and rebuild

like image 164
Cristiana Chavez Avatar answered Sep 29 '22 12:09

Cristiana Chavez


For anybody still wondering, there is finally an official Maven repo for the Facebook SDK:

dependencies {     compile 'com.facebook.android:facebook-android-sdk:3.20.0' } 
like image 38
Tom Redman Avatar answered Sep 29 '22 11:09

Tom Redman