我如何登录facebook android sdk 3.15

时间:2014-07-10 07:33:15

标签: android facebook

我正在尝试facebook sdk 3.15.0。我只想登录facebook。我阅读了文档Fulfill。当我运行我的项目然后我崩溃了。但我无法理解我的错误在哪里。请帮帮我

07-10 07:21:35.213: D/AndroidRuntime(1631): Shutting down VM
07-10 07:21:35.213: W/dalvikvm(1631): threadid=1: thread exiting with uncaught exception (group=0x40a71930)
07-10 07:21:35.243: E/AndroidRuntime(1631): FATAL EXCEPTION: main
07-10 07:21:35.243: E/AndroidRuntime(1631): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.fbapps/com.example.fbapps.MainActivity}: android.view.InflateException: Binary XML file line #8: Error inflating class fragment
07-10 07:21:35.243: E/AndroidRuntime(1631):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
07-10 07:21:35.243: E/AndroidRuntime(1631):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
07-10 07:21:35.243: E/AndroidRuntime(1631):     at android.app.ActivityThread.access$600(ActivityThread.java:141)
07-10 07:21:35.243: E/AndroidRuntime(1631):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
07-10 07:21:35.243: E/AndroidRuntime(1631):     at android.os.Handler.dispatchMessage(Handler.java:99)
07-10 07:21:35.243: E/AndroidRuntime(1631):     at android.os.Looper.loop(Looper.java:137)
07-10 07:21:35.243: E/AndroidRuntime(1631):     at android.app.ActivityThread.main(ActivityThread.java:5041)
07-10 07:21:35.243: E/AndroidRuntime(1631):     at java.lang.reflect.Method.invokeNative(Native Method)
07-10 07:21:35.243: E/AndroidRuntime(1631):     at java.lang.reflect.Method.invoke(Method.java:511)
07-10 07:21:35.243: E/AndroidRuntime(1631):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
07-10 07:21:35.243: E/AndroidRuntime(1631):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
07-10 07:21:35.243: E/AndroidRuntime(1631):     at dalvik.system.NativeStart.main(Native Method)
07-10 07:21:35.243: E/AndroidRuntime(1631): Caused by: android.view.InflateException: Binary XML file line #8: Error inflating class fragment
07-10 07:21:35.243: E/AndroidRuntime(1631):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
07-10 07:21:35.243: E/AndroidRuntime(1631):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
07-10 07:21:35.243: E/AndroidRuntime(1631):     at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
07-10 07:21:35.243: E/AndroidRuntime(1631):     at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
07-10 07:21:35.243: E/AndroidRuntime(1631):     at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
07-10 07:21:35.243: E/AndroidRuntime(1631):     at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:270)
07-10 07:21:35.243: E/AndroidRuntime(1631):     at android.app.Activity.setContentView(Activity.java:1881)
07-10 07:21:35.243: E/AndroidRuntime(1631):     at com.example.fbapps.MainActivity.onCreate(MainActivity.java:26)
07-10 07:21:35.243: E/AndroidRuntime(1631):     at android.app.Activity.performCreate(Activity.java:5104)
07-10 07:21:35.243: E/AndroidRuntime(1631):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
07-10 07:21:35.243: E/AndroidRuntime(1631):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
07-10 07:21:35.243: E/AndroidRuntime(1631):     ... 11 more
07-10 07:21:35.243: E/AndroidRuntime(1631): Caused by: android.support.v4.app.Fragment$InstantiationException: Unable to instantiate fragment com.facebook.scrumptious.SelectionFragment: make sure class name exists, is public, and has an empty constructor that is public
07-10 07:21:35.243: E/AndroidRuntime(1631):     at android.support.v4.app.Fragment.instantiate(Fragment.java:401)
07-10 07:21:35.243: E/AndroidRuntime(1631):     at android.support.v4.app.Fragment.instantiate(Fragment.java:369)
07-10 07:21:35.243: E/AndroidRuntime(1631):     at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:272)
07-10 07:21:35.243: E/AndroidRuntime(1631):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:676)
07-10 07:21:35.243: E/AndroidRuntime(1631):     ... 21 more
07-10 07:21:35.243: E/AndroidRuntime(1631): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.facebook.scrumptious.SelectionFragment" on path: /data/app/com.example.fbapps-2.apk
07-10 07:21:35.243: E/AndroidRuntime(1631):     at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
07-10 07:21:35.243: E/AndroidRuntime(1631):     at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
07-10 07:21:35.243: E/AndroidRuntime(1631):     at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
07-10 07:21:35.243: E/AndroidRuntime(1631):     at android.support.v4.app.Fragment.instantiate(Fragment.java:391)
07-10 07:21:35.243: E/AndroidRuntime(1631):     ... 24 more

我的代码在这里:

类:

enter link description here

清单:

     <activity android:name="com.facebook.LoginActivity"
          android:theme="@android:style/Theme.Translucent.NoTitleBar"
          android:label="@string/app_name" />
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/app_id"/>

1 个答案:

答案 0 :(得分:0)

正在发生的事情是android-support-v4.jar不在您的项目Libraries中。要添加它,请执行以下操作:

在您的项目属性中 - &gt; Java构建路径 - &gt;图书馆 - &gt;添加外部JAR(转到您的sdk文件夹,在'extras'文件夹下选择'Android' - &gt; support - &gt; v4 - &gt; android-support-v4.jar)添加文件并返回“订购并导出”选项卡并检查android-support-v4.jar选项。最后,构建或清理项目。