Unable to configure Facebook SDK in eclipse

人走茶凉 提交于 2019-12-19 11:53:20

问题


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?


回答1:


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!!




回答2:


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.




回答3:


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

Fixed it by setting the correct path.




回答4:


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



来源:https://stackoverflow.com/questions/15964816/unable-to-configure-facebook-sdk-in-eclipse

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!