无法在 Eclipse 中配置 Facebook SDK [英] Unable to configure Facebook SDK in eclipse

查看:16
本文介绍了无法在 Eclipse 中配置 Facebook SDK的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我按照facebook教程完成了所有步骤,关于如何配置facebook SDK,没有任何运气,还尝试了github配置,如图所示Eclipse 上的 Android Facebook SDK 配置

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

而且我还在 eclipse 环境中得到一个!"在项目旁边签名,我将 Facebook 加入其中.并且在尝试运行时,它说我有错误.

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.

在没有 Facebook SDK 的情况下,我成功地在我的项目上工作并运行它,所以这对我的项目来说不是问题..

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

我能做什么?

推荐答案

我尝试开始在 Eclipse 中使用 Facebook 的 Android SDK,但无法正常工作.在尝试了不同的事情之后,这里是始终有效的解决方案:

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) 仅导入(File->Import->Existing Android Code Into Workspace)仅 Facebook SDK 文件夹(PATHfacebook-android-sdk-3.0.1).(不要检查副本到工作场所)

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

2) 仅导入示例项目之一(即 PATHfacebook-android-sdk-3.0.1samplesProfilePictureSample)(目前).我将以 ProfilePictureSample 为例

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

如您所见,Eclipse 抛出错误,指出它不知道 ProfilePictureSampleActivity 中的 FragmentActivity 是什么.FragmentActivity 是 android 支持库的一部分.如果您查看包资源管理器,则没有 libs 文件夹或对 android 支持库的任何引用;它位于 FacebookSDK 库中.我们需要告诉 Eclipse 导出它.

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) 右键单击​​ FacebookSDK 库,然后单击属性.在左侧菜单中,转到 Java Build Path.然后在 Order and Export 选项卡下检查 Android Private Libraries(您也可以点击 android-supportv4-jar 代替).

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) 项目->清理

现在由于某种原因(也许有人可以详细说明),示例项目还需要导出android支持库.

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

6) 右键单击​​示例项目(即 ProfilePictureSample),然后单击属性.在左侧菜单中,转到 Java Build Path.然后在 Order and Export 选项卡下检查 Android Private Libraries.

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) 项目->清理

希望这会有所帮助!

这篇关于无法在 Eclipse 中配置 Facebook SDK的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆