Reputation: 1
Integrating facebook sdk with android app.before integrating app working fine but once working with facebook app stopped unexpectedly here i am placing the code.suggest me how to fix this
public class MainActivity extends Activity implements OnClickListener {
Button btnTOLogin, btnTOPost, logOut;
String APP_ID;
Facebook fb;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
APP_ID = "308180782571605";
fb = new Facebook(APP_ID);
try {
btnTOLogin = (Button) findViewById(R.id.button1);
btnTOPost = (Button) findViewById(R.id.button2);
logOut = (Button) findViewById(R.id.button3);
btnTOLogin.setOnClickListener(this);
btnTOPost.setOnClickListener(this);
logOut.setOnClickListener(this);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
here logs
08-15 22:08:52.531: E/AndroidRuntime(2151): FATAL EXCEPTION: main
08-15 22:08:52.531: E/AndroidRuntime(2151): java.lang.NoClassDefFoundError: com.facebook.android.Facebook
08-15 22:08:52.531: E/AndroidRuntime(2151): at com.sri.z4globalsoft.MainActivity.onCreate(MainActivity.java:25)
08-15 22:08:52.531: E/AndroidRuntime(2151): at android.app.Activity.performCreate(Activity.java:4465)
08-15 22:08:52.531: E/AndroidRuntime(2151): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
08-15 22:08:52.531: E/AndroidRuntime(2151): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1919)
08-15 22:08:52.531: E/AndroidRuntime(2151): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1980)
08-15 22:08:52.531: E/AndroidRuntime(2151): at android.app.ActivityThread.access$600(ActivityThread.java:122)
08-15 22:08:52.531: E/AndroidRuntime(2151): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1146)
08-15 22:08:52.531: E/AndroidRuntime(2151): at android.os.Handler.dispatchMessage(Handler.java:99)
08-15 22:08:52.531: E/AndroidRuntime(2151): at android.os.Looper.loop(Looper.java:137)
08-15 22:08:52.531: E/AndroidRuntime(2151): at android.app.ActivityThread.main(ActivityThread.java:4340)
08-15 22:08:52.531: E/AndroidRuntime(2151): at java.lang.reflect.Method.invokeNative(Native Method)
08-15 22:08:52.531: E/AndroidRuntime(2151): at java.lang.reflect.Method.invoke(Method.java:511)
08-15 22:08:52.531: E/AndroidRuntime(2151): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
08-15 22:08:52.531: E/AndroidRuntime(2151): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
08-15 22:08:52.531: E/AndroidRuntime(2151): at dalvik.system.NativeStart.main(Native Method)
Upvotes: 0
Views: 1532
Reputation: 3322
clean the project..| go to libs folder select facebookjar right click and select add to build path (or) Java Build Path -> Order & Export and make sure facebook library is ticked. some times it depends on order of libraries in order and export move up and down check it may come
Upvotes: 0
Reputation: 10635
Go to Project -> Properties -> Java Build Path -> Order & Export and make sure facebook library is ticked.
Upvotes: 1