0

I did all the steps according to the facebook tutorial on how to configure the facebook SDK, and without any luck, also tried the github configuration as shown Android Facebook SDK configuration on Eclipse

And I'm still getting in the eclipse environment a "!" sign by the side of the project I included Facebook to it. and when trying to run, it says I have errors.

Without the Facebook SDK I managed to work great on my project and run it, so it is not a problem with my project..

What can I do?

Community
  • 1
  • 1
Javi
  • 889
  • 1
  • 16
  • 41

4 Answers4

3

I was trying to get started using Facebook's SDK for Android with Eclipse and couldn't get it to work. After trying different things here is the solution that consistently works:

1) Import (File->Import->Existing Android Code Into Workspace) just the Facebook SDK folder alone (PATH\facebook-android-sdk-3.0.1). (Do not check the copy to workplace)

2) Import (i.e. PATH\facebook-android-sdk-3.0.1\samples\ProfilePictureSample) just one of the sample projects (for now). I will be using ProfilePictureSample as an example

As you can see, Eclipse throws errors saying that it doesn't know what FragmentActivity in ProfilePictureSampleActivity. FragmentActivity is part of the android support library. If you take a look at the package explorer, there is not a libs folder or any reference to the android support lirbary; It is on the FacebookSDK library. We need to tell Eclipse to export it.

4) Right-Click on the FacebookSDK library then click on properties. On the left menu go to Java Build Path. Then under the Order and Export tab check Android Private Libraries (you can also click on the android-supportv4-jar instead).

5) Project->Clean

Now for some reason (maybe somebody can elaborate on this), the sample project also needs to export the android support library.

6) Right-Click on the sample project (i.e. ProfilePictureSample) then click on properties. On the left menu go to Java Build Path. Then under the Order and Export tab check Android Private Libraries.

7) Project->Clean

Hopefully this helps!!

Emmanuel
  • 13,083
  • 4
  • 39
  • 53
0

please set the Android Api for this project by this steps below

Rightclick on project->properties->android->set android Target version

Also remove Facebook library project once and again add it.

nvavadiya
  • 127
  • 11
0

The problem was that the path to the android-supprort-v4.jar wasn't correct..

Fixed it by setting the correct path.

Javi
  • 889
  • 1
  • 16
  • 41
0

Import the sdk without copying the project to workspace. this solution has worked for me and does not present any errors

Alex Kombo
  • 3,256
  • 8
  • 34
  • 67
  • Could you provide a bit more detail on your steps? – Sven Grosen May 13 '14 at 12:11
  • File > import > existing android code into workspace > select the sdk from where its saved > finish. But on the final dialog, make sure the checkbox for copy project into workspace is unchecked before you click finish. – Alex Kombo May 14 '14 at 13:04