1

I'm trying to implement the Facebook implementation as mentioned in the following link -

https://developers.facebook.com/docs/mobile/android/build/

However, after I've implemented upto step 6.3 and try to run my application, I'm being shown the following error message in the log -

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)

I'm using Android 2.1 with version 7 as the mini SDK. Any pointers on this would be of great help.

Thanks in advance, Amitava

Andro Selva
  • 53,910
  • 52
  • 193
  • 240
  • Have you try to run the demo application (Hackbook) that comes in the downloaded bundle. – Praful Bhatnagar Mar 01 '12 at 08:58
  • It is easy to implement check the link below [facebook integration][1] [1]: http://stackoverflow.com/questions/8162451/facebook-twitter-integration-in-my-android-application – Naresh Sharma Mar 01 '12 at 09:05

1 Answers1

1

it's quite easy ....

Download the code for facebook SDK and add as a library in your project and then run it.

Add two variables as

String appId="000000000000000"; //your appp ID
Facebook facebook;

and initialise the facebook variable

facebook = new Facebook(appId);
Johannes Weiss
  • 52,533
  • 16
  • 102
  • 136
user1161960
  • 90
  • 1
  • 9
  • Hi, I downloaded the facebook SDK from github, linked it to my application as a library, and tried to run my application by creating the application ID and instance of Facebook. But I'm being shown the following error - java.lang.NoClassDefFoundError: com.facebook.android.Facebook – user1164838 Mar 01 '12 at 11:20
  • please add facebook sdk as a reference (library) from the android section under property window and test it ... – user1161960 Mar 02 '12 at 13:25
  • Hi, I have completed upto step 6.4 mentioned in the following URL - https://developers.facebook.com/docs/mobile/android/build/ but still I'm facing the NoClassDefFoundError for the Facebook class. Any pointers on this would be really helpful. I'm using Android 2.2 in my emulator. Thanks in advance,Amitava – user1164838 Mar 07 '12 at 07:16