我實施了twitter整合到我的android項目中的問題是代碼工作了一段時間它顯示錯誤的代碼。我不明白我的代碼有什麼問題。以下是我的代碼和log-cat錯誤。Twitter不工作在我的項目
consumer = new DefaultOAuthConsumer(TWITTER_OAUTH_KEY,TWITTER_OAUTH_SECRET);
provider = new DefaultOAuthProvider(
"http://twitter.com/oauth/request_token",
"http://twitter.com/oauth/access_token",
"http://twitter.com/oauth/authorize");
mTwitterBtn = (CheckBox) findViewById(R.id.twitterCheck);
mTwitter = new TwitterApp(this, twitter_consumer_key,twitter_secret_key);
mTwitter.setListener(mTwLoginDialogListener);
mTwitterBtn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (mTwitter.hasAccessToken()) {
postToTwitter = mTwitterBtn.isChecked();
Intent shareIntent = new Intent(
ShareApplicationTweeter.this, PostApplication.class);
startActivity(shareIntent);
// share("Hi", "Test");
} else {
mTwitterBtn.setChecked(false);
mTwitter.authorize();
}
}
});
if (mTwitter.hasAccessToken()) {
username = mTwitter.getUsername();
username = (username.equals("")) ? "No Name" : username;
mTwitterBtn.setText(" Twitter (" + username + ")");
}
1月4日至19日:24:04.001:E/AndroidRuntime(545):致命異常:主 1月4日至19日:24:04.001:E/AndroidRuntime(545):java.lang.NoClassDefFoundError: oauth.signpost.basic.DefaultOAuthConsumer 04-19 01:24:04.001:E/AndroidRuntime(545):at com.a1.buzzmob.ShareApplicationTweeter.onCreate(ShareApplicationTweeter.java:86) 04-19 01:24:04.001 :E/AndroidRuntime(545):在android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 04-19 01:24:04.001:E/AndroidRuntime(545):at android.app.ActivityThread.performLaunchActivity(ActivityThread .java:2627) 04-19 01:24:04.001:E/AndroidRuntime(545):at android.app.ActivityThread.han dleLaunchActivity(ActivityThread.java:2679) 04-19 01:24:04.001:E/AndroidRuntime(545):at android.app.ActivityThread.access $ 2300(ActivityThread.java:125) 04-19 01:24:04.001 :E/AndroidRuntime(545):at android.app.ActivityThread $ H.handleMessage(ActivityThread.java:2033) 04-19 01:24:04.001:E/AndroidRuntime(545):at android.os.Handler.dispatchMessage (Handler.java:99) 04-19 01:24:04.001:E/AndroidRuntime(545):at android.os.Looper.loop(Looper.java:123) 04-19 01:24:04.001:E/AndroidRuntime(545):at android.app.ActivityThread.main(ActivityThread.java:4627) 04-19 01:24:04.001:E/AndroidRuntime(545):at java.lang.reflect.Method.invokeNative(Native方法) 04-19 01:24:04.001:E/AndroidRuntime(545):at java.lang.reflect.Method.invoke(Method.java:521) 04-19 01:24:04.001:E/AndroidRuntime(545):at com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:868) 04-19 01:24:04.001:E/AndroidRuntime(545):at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) 04-19 01:24:04.001:E/AndroidRuntime(545):at dalvik.system.NativeStart.main(本地方法) 04-19 01:29:04.033:I /過程(545):發送信號。 PID:545 SIG:9
謝謝, Murali。
USE SEARCH !!!!!!!!您已將ADT更改爲17,因此請檢查第一個結果... http://stackoverflow.com/search?q=%5BNoClassDefFoundError%5D+%5Bandroid%5D+adt+17 – Selvin 2012-03-29 11:47:11