[Java for Android App Development] rakeshdas:
I am writing a simple about android app that posts a status on your Facebook wall, and I am getting a crash caused by setContentView. I set up the Facebook API correctly I believe, but I am still getting a crash. Below is all of the code.

activity_main.java:

package com.rakesh.itijgm;

import android.app.Activity;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;

import com.facebook.android.AsyncFacebookRunner;
import com.facebook.android.DialogError;
import com.facebook.android.Facebook;
import com.facebook.android.FacebookError;

public class MainActivity extends Activity {

private static String APP_ID = "443967745743818";
private Facebook facebook;
private AsyncFacebookRunner mAsyncRunner;
String FILENAME = "AndroidSSO_data";
private SharedPreferences mPrefs;

[MENTION=439709]override[/MENTION]
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main); [COLOR="Red"][B]//THE APP CRASHES HERE[/B][/COLOR]
Button btn_fb_login = (Button) findViewById(R.id.btn_fb_login);
facebook = new Facebook(APP_ID);
mAsyncRunner = new AsyncFacebookRunner(facebook);

btn_fb_login.setOnClickListener(new View.OnClickListener() {
[MENTION=439709]override[/MENTION]
public void onClick(View view) {
loginToFacebook();
}
});

}
//fb_login
public void loginToFacebook(){
mPrefs = getPreferences(MODE_PRIVATE);
String access_token = mPrefs.getString("access_token", null);
long expires = mPrefs.getLong("access_expires", 0);
if (access_token != null){
facebook.setAccessToken(access_token);
}
if (expires != 0){
facebook.setAccessExpires(expires);
}
if (!facebook.isSessionValid()){
facebook.authorize(this,
new String[]{"email", "publish_stream"},
new Facebook.DialogListener() {
[MENTION=439709]override[/MENTION]
public void onComplete(Bundle values) {
SharedPreferences.Editor editor = mPrefs.edit();
editor.putString("access_token", facebook.getAccessToken());
editor.putLong("access_expires",facebook.getAccessExpires());
editor.commit();
}

[MENTION=439709]override[/MENTION]
public void onFacebookError(FacebookError fberror) {

}

[MENTION=439709]override[/MENTION]
public void onError(DialogError error) {

}

[MENTION=439709]override[/MENTION]
public void onCancel() {

}

});
}}

[MENTION=439709]override[/MENTION]
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}

[MENTION=439709]override[/MENTION]
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}

I also have my Stack trace:

Caused by: java.lang.ClassNotFoundException: Didn't find class "com.facebook.widget.LoginButton" on path: DexPathList[[zip file "/data/app/com.rakesh.itijgm-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.rakesh.itijgm-1, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
at android.view.LayoutInflater.createView(LayoutInflater.java:559)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at de.robv.android.xposed.XposedBridge.invokeOriginalMethodNative(Native Method)
at de.robv.android.xposed.XposedBridge.handleHookedMethod(XposedBridge.java:631)
at android.view.LayoutInflater.inflate(Native Method)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:343)
at android.app.Activity.setContentView(Activity.java:1936)
at com.rakesh.itijgm.MainActivity.onCreate(MainActivity.java:34)
at android.app.Activity.performCreate(Activity.java:5313)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2181)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2276)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1205)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5146)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:796)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:612)
at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:132)
at dalvik.system.NativeStart.main(Native Method)

I made sure that the findViewById is referred to the correct element, and that is good, so I can't decipher the problem here.