Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Facebook SDK configuration on Eclipse

I downloaded the android's facebook sdk but so far I couldn't configure properly. Eclipse doesn't recognize the facebook sdk as a project.

Does anyone got this problem?

like image 585
Thiago M Rocha Avatar asked Feb 09 '11 13:02

Thiago M Rocha


People also ask

What SDK does Facebook use?

The current version of the Facebook SDK for Android is version 14.1. 0 and requires the Android API 15. Code and samples for the Facebook SDK for Android are available on GitHub.

How do I change my key hash on Facebook?

Go to your Facebook App --> Settings--> Paste Hash key in "key hashes" option -->save changes. Now Test your android app with Facebook Log-in/Share etc.


3 Answers

You should use the git plugin to import the facebook project from github into your eclipse workspace. It's configured as an android library. And then in your android project in which you want to use the library. Right click on the project and choose properties. Click on the Android tab, and at the bottom should be a section for libraries, detailed instructions here. Click Add, and the facebook sdk should appear. Check the facebook sdk and it will then be available in your app.

like image 62
Robby Pond Avatar answered Oct 03 '22 10:10

Robby Pond


Facebook SDK integration into an android application should be easy, but there are some caveats to take care of during the first integration steps, so follow it carefully:

  1. Download the SDK from git hub - This could be done using a github client, but an easier way is to simply download the zipped version by pressing the "zip" button as appears in the following snapshot.

    downloading facebook SDK from github as Zipped project

  2. Extract the zip file - make sure to extract it into a folder that is not within the eclipse workspace. In the next step you will need to create a project in eclipse based on this zip, but sometimes, putting the extracted zip directly into the workspace confuses eclipse, so avoid putting it there. Put it somewhere else.

  3. Open Eclipse and create a new Android Project (File -> New -> Project -> Android Project) for the Facebook Android SDK source. (On the next step you will add it as a reference library to your app). Create the project by selecting "Create project from existing source" and specify the facebook-sdk folder into which you extracted the zip. (note: if you want it to be stored in the workspace itself, you can always "import" the project into the workspace later on)

    create project from existing source

  4. Add it as a project library to your app by selection the current project (of your app) -> properties, and add the facebook project as a library to your current project.

  5. later steps include adding permissions to the Android Manifest such as
    uses-permission android:name="android.permission.INTERNET"/> and then adding your application ID into the code. I will skip the details here as it is quite straight forward.

like image 27
wiztrail Avatar answered Oct 04 '22 10:10

wiztrail


following steps are for creating facbook-android.jar (use this jar file in your any project)


Step1: Download Facebook Android SDK from github.
Step2: Extract it. (at any location).
Step3: In Eclipse create new project using create project from existing source option
Step4: Enter the project name as "com_facebook_android".
Step5: Set Location to "facebook" folder in extracted location.
Step6: Click Finish.
Step7: Select the "com_facebook_android" project in project explorer and right click
select export option.
Step8: In the export wizard select JAR file in Java folder.
Step9: Click next then browse the location for jar file and give the name as yor wish like "facebook-android.jar"
Step10: Click finish........ JAR file will be created in that location

This is not correct process, you should use facebook-android project as library project, because resource files will not import to your project while you are using .jar file

jar file is only for Java Projects not for Android Project, Some of jar files may work but not all..

like image 31
Prasanna Avatar answered Oct 03 '22 10:10

Prasanna