I am implementing Facebook in my app through FbRocket jar, but it gives some error as ClassNotFound, but I don't know why bcoz i have alredy added that jar in libraries........
Please help me out.
05-09 19:04:28.933: ERROR/AndroidRuntime(759): FATAL EXCEPTION: main
05-09 19:04:28.933: ERROR/AndroidRuntime(759): java.lang.NoClassDefFoundError: net.xeomax.FBRocket.FBRocket
05-09 19:04:28.933: ERROR/AndroidRuntime(759): at org.shopzilla.android.moretab.SettingActivity.shareFacebook(SettingActivity.java:73)
05-09 19:04:28.933: ERROR/AndroidRuntime(759): at org.shopzilla.android.moretab.SettingActivity$2.onClick(SettingActivity.java:63)
05-09 19:04:28.933: ERROR/AndroidRuntime(759): at android.view.View.performClick(View.java:2485)
05-09 19:04:28.933: ERROR/AndroidRuntime(759): at android.view.View$PerformClick.run(View.java:9080)
05-09 19:04:28.933: ERROR/AndroidRuntime(759): at android.os.Handler.handleCallback(Handler.java:587)
05-09 19:04:28.933: ERROR/AndroidRuntime(759): at android.os.Handler.dispatchMessage(Handler.java:92)
05-09 19:04:28.933: ERROR/AndroidRuntime(759): at android.os.Looper.loop(Looper.java:123)
05-09 19:04:28.933: ERROR/AndroidRuntime(759): at android.app.ActivityThread.main(ActivityThread.java:3683)
05-09 19:04:28.933: ERROR/AndroidRuntime(759): at java.lang.reflect.Method.invokeNative(Native Method)
05-09 19:04:28.933: ERROR/AndroidRuntime(759): at java.lang.reflect.Method.invoke(Method.java:507)
05-09 19:04:28.933: ERROR/AndroidRuntime(759): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
05-09 19:04:28.933: ERROR/AndroidRuntime(759): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
05-09 19:04:28.933: ERROR/AndroidRuntime(759): at dalvik.system.NativeStart.main(Native Method)
Code:
package org.shopzilla.android.moretab;
import java.util.List;
import net.xeomax.FBRocket.FBRocket;
import net.xeomax.FBRocket.Facebook;
import net.xeomax.FBRocket.ServerErrorException;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.shopzilla.android.common.R;
import org.shopzilla.android.facebook.FacebookActivity;
import org.shopzilla.android.facebook.FacebookWebOAuthActivity;
import org.shopzilla.android.twitter.TwitterActivity;
import org.shopzilla.android.twitter.TwitterWebOAuthActivity;
import twitter4j.http.RequestToken;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
public class SettingActivity extends Activity{
String bytesSent;
HttpClient httpclient;
int count1;
// List with parameters and their values
List<NameValuePair> nameValuePairs;
TextView mText;
Button btn_facebook;
Button btn_twitter;
FBRocket fbRocket;
RequestToken rToken;
String oauthVerifier;
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.more_setting);
Button btn_twitter = (Button)findViewById(R.id.btn_more_setting_twitter);
Button btn_facebook = (Button)findViewById(R.id.btn_More_setting_facebook);
btn_twitter.setOnClickListener(new View.OnClickListener() {
public void onClick(View arg0) {
// TODO Auto-generated method stub
Intent intent = new Intent(SettingActivity.this,TwitterActivity.class);
startActivity(intent);
//displayTwitterAuthorization();
}
});
btn_facebook.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
/*Intent intent = new Intent(SettingActivity.this,FacebookActivity.class);
startActivity(intent);*/
shareFacebook();
//displayFacebookAuthorization();
//shareFacebook();
}
});
}
public void shareFacebook() {
fbRocket = new FBRocket(SettingActivity.this, "ShopZilla",
"172619129456913");
if (fbRocket.existsSavedFacebook()) {
fbRocket.loadFacebook();
} else {
fbRocket.login(R.layout.facebook);
}
}
public void onLoginFail() {
fbRocket.displayToast("Login failed!");
fbRocket.login(R.layout.facebook);
}
public void onLoginSuccess(Facebook facebook) {
// TODO Auto-generated method stub
fbRocket.displayToast("Login success!");
try {
facebook.setStatus("This is your status");
fbRocket.displayDialog("Status Posted Successfully!! "
+ facebook.getStatus());
} catch (ServerErrorException e) {
if (e.notLoggedIn()) {
fbRocket.login(R.layout.facebook);
} else {
System.out.println(e);
}
}
}
}