Trouble with Android Facebook SDK on Java, Android
I create app for working with facebook. I download Android Facebook SDK from GitHub, than I create a new Android project for sdk in Eclipse (when I'm creating a new project for sdk, i selected "create from existing source"). Than I added to my project this facebook project ("build path", etc). But when I want to create a new Facebook object, I got unhandled error. It is code:
Facebook fb=new Facebook(APP_ID);
Where have I do mistake?
Error log:
- 09-29 05:23:21.295: ERROR/AndroidRuntime(1256):
java.lang.NoClassDefFoundError: com.facebook.android.Facebook 09-29
05:23:21.295: ERROR/AndroidRuntime(1256): at
com.nda.mailinglist.SimpleAndroidMailingListActivity.onContextItemSelected(SimpleAndroidMailingListActivity.java:80)
09-29 05:23:21.295: ERROR/AndroidRuntime(1256): at
android.app.Activity.onMenuItemSelected(Activity.java:2174) 09-29
05:23:21.295: ERROR/AndroidRuntime(1256): at
com.android.internal.policy.impl.PhoneWindow$ContextMenuCallback.onMenuItemSelected(PhoneWindow.java:2731)
09-29 05:23:21.295: ERROR/AndroidRuntime(1256): at
com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:139)
09-29 05:23:21.295: ERROR/AndroidRuntime(1256): at
com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:855)
09-29 05:23:21.295: ERROR/AndroidRuntime(1256): at
com.android.internal.view.menu.MenuDialogHelper.onClick(MenuDialogHelper.java:129)
09-29 05:23:21.295: ERROR/AndroidRuntime(1256): at
com.android.internal.app.AlertController$AlertParams$3.onItemC开发者_StackOverflow中文版lick(AlertController.java:884)
09-29 05:23:21.295: ERROR/AndroidRuntime(1256): at
android.widget.AdapterView.performItemClick(AdapterView.java:284)
09-29 05:23:21.295: ERROR/AndroidRuntime(1256): at
android.widget.ListView.performItemClick(ListView.java:3285) 09-29
05:23:21.295: ERROR/AndroidRuntime(1256): at
android.widget.AbsListView$PerformClick.run(AbsListView.java:1640)
09-29 05:23:21.295: ERROR/AndroidRuntime(1256): at
android.os.Handler.handleCallback(Handler.java:587) 09-29
05:23:21.295: ERROR/AndroidRuntime(1256): at
android.os.Handler.dispatchMessage(Handler.java:92) 09-29
05:23:21.295: ERROR/AndroidRuntime(1256): at
android.os.Looper.loop(Looper.java:123) 09-29 05:23:21.295:
ERROR/AndroidRuntime(1256): at
android.app.ActivityThread.main(ActivityThread.java:4363) 09-29
05:23:21.295: ERROR/AndroidRuntime(1256): at
java.lang.reflect.Method.invokeNative(Native Method) 09-29
05:23:21.295: ERROR/AndroidRuntime(1256): at
java.lang.reflect.Method.invoke(Method.java:521) 09-29 05:23:21.295:
ERROR/AndroidRuntime(1256): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
09-29 05:23:21.295: ERROR/AndroidRuntime(1256): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) 09-29
05:23:21.295: ERROR/AndroidRuntime(1256): at
dalvik.system.NativeStart.main(Native Method)
Facebook sdk project should be on same drive in which you have your project. For example if you have your project code in C: drive but you have placed facebook sdk in D: drive then it wont work. Both should be in same drive.
精彩评论