Facebook用于登录并获取用户详细信息,包括电子邮件地址

时间:2013-12-24 02:21:00

标签: android facebook facebook-authentication

我推荐其他人代码来获取fb用户详细信息,包括电子邮件地址。 http://www.kpbird.com/2013/03/android-login-using-facebook-sdk-30.html

但它有错误

    12-24 10:02:00.836: E/AndroidRuntime(3736): FATAL EXCEPTION: main
12-24 10:02:00.836: E/AndroidRuntime(3736): java.lang.NoClassDefFoundError: android.support.v4.content.LocalBroadcastManager
12-24 10:02:00.836: E/AndroidRuntime(3736):     at com.facebook.internal.SessionTracker.<init>(SessionTracker.java:76)
12-24 10:02:00.836: E/AndroidRuntime(3736):     at com.facebook.widget.LoginButton.finishInit(LoginButton.java:533)
12-24 10:02:00.836: E/AndroidRuntime(3736):     at com.facebook.widget.LoginButton.onFinishInflate(LoginButton.java:526)
12-24 10:02:00.836: E/AndroidRuntime(3736):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:774)
12-24 10:02:00.836: E/AndroidRuntime(3736):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:769)
12-24 10:02:00.836: E/AndroidRuntime(3736):     at android.view.LayoutInflater.inflate(LayoutInflater.java:498)
12-24 10:02:00.836: E/AndroidRuntime(3736):     at android.view.LayoutInflater.inflate(LayoutInflater.java:398)
12-24 10:02:00.836: E/AndroidRuntime(3736):     at android.view.LayoutInflater.inflate(LayoutInflater.java:354)
12-24 10:02:00.836: E/AndroidRuntime(3736):     at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:361)
12-24 10:02:00.836: E/AndroidRuntime(3736):     at android.app.Activity.setContentView(Activity.java:1956)
12-24 10:02:00.836: E/AndroidRuntime(3736):     at com.example.kpbird.MainActivity.onCreate(MainActivity.java:28)
12-24 10:02:00.836: E/AndroidRuntime(3736):     at android.app.Activity.performCreate(Activity.java:5372)
12-24 10:02:00.836: E/AndroidRuntime(3736):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1104)
12-24 10:02:00.836: E/AndroidRuntime(3736):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2257)
12-24 10:02:00.836: E/AndroidRuntime(3736):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2349)
12-24 10:02:00.836: E/AndroidRuntime(3736):     at android.app.ActivityThread.access$700(ActivityThread.java:159)
12-24 10:02:00.836: E/AndroidRuntime(3736):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316)
12-24 10:02:00.836: E/AndroidRuntime(3736):     at android.os.Handler.dispatchMessage(Handler.java:99)
12-24 10:02:00.836: E/AndroidRuntime(3736):     at android.os.Looper.loop(Looper.java:137)
12-24 10:02:00.836: E/AndroidRuntime(3736):     at android.app.ActivityThread.main(ActivityThread.java:5419)
12-24 10:02:00.836: E/AndroidRuntime(3736):     at java.lang.reflect.Method.invokeNative(Native Method)
12-24 10:02:00.836: E/AndroidRuntime(3736):     at java.lang.reflect.Method.invoke(Method.java:525)
12-24 10:02:00.836: E/AndroidRuntime(3736):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1187)
12-24 10:02:00.836: E/AndroidRuntime(3736):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
12-24 10:02:00.836: E/AndroidRuntime(3736):     at dalvik.system.NativeStart.main(Native Method)

这个方法中不能使用facebook LoginButton吗?

1 个答案:

答案 0 :(得分:0)

我解决了这个问题:

1)右键单击FacebookSDK项目&gt; Android工具&gt;添加支持库。

2)对我的项目(以及其他依赖项projetcs)执行相同的操作。

3)清理所有项目