我正在尝试实施以下链接中提到的Facebook实施 -
https://developers.facebook.com/docs/mobile/android/build/
但是,在我实现了步骤6.3并尝试运行我的应用程序后,我在日志中显示以下错误消息 -
03-01 14:19:50.124: W/dalvikvm(329): threadid=3: thread exiting with uncaught exception (group=0x4001b188)
03-01 14:19:50.135: E/AndroidRuntime(329): Uncaught handler: thread main exiting due to uncaught exception
03-01 14:19:50.173: E/AndroidRuntime(329): java.lang.NoClassDefFoundError: com.facebook.android.Facebook
03-01 14:19:50.173: E/AndroidRuntime(329): at com.test.fbandroid.MyGreatAppActivity.<init>(MyGreatAppActivity.java:14)
03-01 14:19:50.173: E/AndroidRuntime(329): at java.lang.Class.newInstanceImpl(Native Method)
03-01 14:19:50.173: E/AndroidRuntime(329): at java.lang.Class.newInstance(Class.java:1479)
03-01 14:19:50.173: E/AndroidRuntime(329): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
03-01 14:19:50.173: E/AndroidRuntime(329): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2409)
03-01 14:19:50.173: E/AndroidRuntime(329): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
03-01 14:19:50.173: E/AndroidRuntime(329): at android.app.ActivityThread.access$2200(ActivityThread.java:119)
03-01 14:19:50.173: E/AndroidRuntime(329): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
03-01 14:19:50.173: E/AndroidRuntime(329): at android.os.Handler.dispatchMessage(Handler.java:99)
03-01 14:19:50.173: E/AndroidRuntime(329): at android.os.Looper.loop(Looper.java:123)
03-01 14:19:50.173: E/AndroidRuntime(329): at android.app.ActivityThread.main(ActivityThread.java:4363)
03-01 14:19:50.173: E/AndroidRuntime(329): at java.lang.reflect.Method.invokeNative(Native Method)
03-01 14:19:50.173: E/AndroidRuntime(329): at java.lang.reflect.Method.invoke(Method.java:521)
03-01 14:19:50.173: E/AndroidRuntime(329): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
03-01 14:19:50.173: E/AndroidRuntime(329): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
03-01 14:19:50.173: E/AndroidRuntime(329): at dalvik.system.NativeStart.main(Native Method)
我使用Android 2.1和版本7作为迷你SDK。 任何关于此的指示都会有很大的帮助。
提前致谢, 阿米塔瓦
答案 0 :(得分:1)
这很容易......
下载facebook SDK的代码并在项目中添加为库,然后运行它。
添加两个变量
String appId="000000000000000"; //your appp ID
Facebook facebook;
并初始化facebook
变量
facebook = new Facebook(appId);