How can i add facebook SDK to android project?
Asked Answered
H

4

10

I'm trying to add facebook SDK to android project but I'm unable to add it, I couldn't do it. My project has one package and there are 8-10 packages in it so where can I add facebook SDK?

I searched a lot on the web but couldn't find good solution.

Hypopituitarism answered 17/1, 2013 at 10:35 Comment(1)
Here is a post I made for this topic #17220127Henriques
C
15

Following are the steps to include Facebook SDK into android project:

1) Download the Facebook SDK from the https://github.com/facebook/facebook-android-sdk/ and extract it to local drive.

2) Import "facebook" as a android project into your Eclipse, this is your Facebook SDK, and You have to reference it to your android project.

3) Now create your android project.

4) Right click on it, go to Properties-->android and Add the "facebook "Library as a reference to your project. click Apply.

Check the video link: http://www.youtube.com/watch?v=w-vNi1W4fco

For more details visit : https://developers.facebook.com/docs/getting-started/facebook-sdk-for-android/3.0/

Cineraria answered 25/1, 2013 at 9:35 Comment(1)
it's possible to include Facebook SDK as Gradle-dependency, check this answer: https://mcmap.net/q/204451/-using-facebook-sdk-in-android-studioScepter
R
3

I succeeded in adding the Facebook SDK to my app as follows :

  • Download the Facebook SDK from their developer page. Extract it in your local file system. It contains the folder named facebook which inturn contains this .aar package. (facebook-android-sdk-4.23.0.aar)

  • Right click on the project -> New -> Module

  • Select the Import .JAR/.AAR package option.

  • Select the above mentioned .aar file.

  • In the build.gradle file of your app add the following to the dependencies section.

    dependencies {
    ...<Your custom dependencies>
    compile 'com.android.support:appcompat-v7:26.+'
    ...<Your custom dependencies>
    compile project(':facebook-android-sdk-4.23.0')
    testCompile 'junit:junit:4.12'
    

    }

  • Build your project and you are good to go!

Note: If you want to check if it is working try adding import com.facebook.FacebookSDK to your MainActivity.java file. If it doesn't show any errors, you have succesfully added the Facebook SDK.

Repairer answered 26/6, 2017 at 7:16 Comment(0)
E
0

Try to open sample project included in FB-SDK and it may be helpful.

Endue answered 17/1, 2013 at 10:42 Comment(2)
I just couldn't add SDK to project. If I can add it, I will able to write code.Hypopituitarism
What does it mean 'you couldn't add SDK to project'? Does Eclipse give you any error?Endue
T
0

see this link and download demo of Facebook SDK..you can get sharing feature in this SDK...

https://github.com/facebook/facebook-android-sdk/

Tide answered 17/1, 2013 at 10:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.