您好,我已经在我的项目中添加了 twitter4j 库,但是当我尝试运行我的程序时,它给出了 java.lang.NoClassDefFoundError: twitter4j.auth.AccessToken 错误
String token ="88888888888888888888888888888888";
String secret = "8888888888888888888888";
AccessToken a = new AccessToken(token,secret);
Twitter twitter = new TwitterFactory().getInstance();
twitter.setOAuthConsumer("888888888", "88888888888888888888");
twitter.setOAuthAccessToken(a);
try {
twitter.updateStatus("i ma app");
} catch (TwitterException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.twitter"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="19" />
<!-- So that we can get the account name -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<!-- Used to request data from the Google+ APIs in the SignInActivity -->
<uses-permission android:name="android.permission.INTERNET" />
<!-- Required if we need to invalidate access tokens -->
<uses-permission android:name="android.permission.USE_CREDENTIALS"/>
<application android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.twitter.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>