我实现了twitter集成到我的android项目中的问题是代码工作了一些次,它显示错误。我不明白我的代码有什么问题。我的代码和log-cat错误。
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 + ")");
}
04-19 01:24:04.001:E / AndroidRuntime(545):致命异乎寻常:主要 04-19 01: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):在android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627) 04-19 01:24:04.001:E / AndroidRuntime(545):在android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679) 04-19 01:24:04.001:E / AndroidRuntime(545):在android.app.ActivityThread.access $ 2300(ActivityThread.java:125) 04-19 01:24:04.001:E / AndroidRuntime(545):在android.app.ActivityThread $ H.handleMessage(ActivityThread.java:2033) 04-19 01:24:04.001:E / AndroidRuntime(545):在android.os.Handler.dispatchMessage(Handler.java:99) 04-19 01:24:04.001:E / AndroidRuntime(545):在android.os.Looper.loop(Looper.java:123) 04-19 01:24:04.001:E / AndroidRuntime(545):在android.app.ActivityThread.main(ActivityThread.java:4627) 04-19 01:24:04.001:E / AndroidRuntime(545):at java.lang.reflect.Method.invokeNative(Native Method) 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(Native Method) 04-19 01:29:04.033:I / Process(545):发送信号。 PID:545 SIG:9
谢谢, 穆拉利。
答案 0 :(得分:0)
将您的库移至“libs”文件夹