Search code examples
androidtwittertwitter-oauth

Oauth error (twitter integration)


Sorry if it could easy for you, but have 2 days that I trying to find a working twitter sample, every sample stop when try to request token, reading twitter forum, people says that could be internal system clock, I´ve set to my local date and time.

Using:

public static final String REQUEST_URL = "http://api.twitter.com/oauth/request_token";

public static final String ACCESS_URL = "http://api.twitter.com/oauth/access_token";

public static final String AUTHORIZE_URL = "http://api.twitter.com/oauth/authorize";

Callback URL http://www.google.com (inside twitter Oauth Settings, people says to not leave it blank)

I already checked both tokens, and set to read and write.


Solution

  • twitter4j => AndroidRuntime(446): java.lang.NoClassDefFoundError: twitter4j.http.AccessToken

    Following error messages:

    E/dalvikvm(374): Could not find class 'twitter4j.http.AccessToken', referenced from method com.ecs.android.sample.twitter.TwitterUtils.isAuthenticated
    W/dalvikvm(374): VFY: unable to resolve new-instance 67 (Ltwitter4j/http/AccessToken;) in Lcom/ecs/android/sample/twitter/TwitterUtils;
    D/dalvikvm(374): VFY: replacing opcode 0x22 at 0x0010
    D/dalvikvm(374): VFY: dead code 0x0012-002f in Lcom/ecs/android/sample/twitter/TwitterUtils;.isAuthenticated (Landroid/content/SharedPreferences;)Z
    E/dalvikvm(374): Could not find class 'twitter4j.http.AccessToken', referenced from method com.ecs.android.sample.twitter.TwitterUtils.sendTweet
    W/dalvikvm(374): VFY: unable to resolve new-instance 67 (Ltwitter4j/http/AccessToken;) in Lcom/ecs/android/sample/twitter/TwitterUtils;
    D/dalvikvm(374): VFY: replacing opcode 0x22 at 0x0010
    D/dalvikvm(374): VFY: dead code 0x0012-002b in Lcom/ecs/android/sample/twitter/TwitterUtils;.sendTweet (Landroid/content/SharedPreferences;Ljava/lang/String;)V
    D/AndroidRuntime(374): Shutting down VM
    W/dalvikvm(374): threadid=1: thread exiting with uncaught exception (group=0x40015560)
    E/AndroidRuntime(374): FATAL EXCEPTION: main
    E/AndroidRuntime(374): java.lang.NoClassDefFoundError: twitter4j.http.AccessToken
    E/AndroidRuntime(374): at com.ecs.android.sample.twitter.TwitterUtils.isAuthenticated(TwitterUtils.java:18)
    E/AndroidRuntime(374): at com.ecs.android.sample.twitter.AndroidTwitterSample.updateLoginStatus(AndroidTwitterSample.java:72)
    E/AndroidRuntime(374): at com.ecs.android.sample.twitter.AndroidTwitterSample.onResume(AndroidTwitterSample.java:68)
    E/AndroidRuntime(374): at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1150)
    E/AndroidRuntime(374): at android.app.Activity.performResume(Activity.java:3832)
    E/AndroidRuntime(374): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2110)
    E/AndroidRuntime(374): at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2135)
    E/AndroidRuntime(374): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1668)
    E/AndroidRuntime(374): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
    E/AndroidRuntime(374): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
    E/AndroidRuntime(374): at android.os.Handler.dispatchMessage(Handler.java:99)
    E/AndroidRuntime(374): at android.os.Looper.loop(Looper.java:130)
    E/AndroidRuntime(374): at android.app.ActivityThread.main(ActivityThread.java:3683)
    E/AndroidRuntime(374): at java.lang.reflect.Method.invokeNative(Native Method)
    E/AndroidRuntime(374): at java.lang.reflect.Method.invoke(Method.java:507)
    E/AndroidRuntime(374): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
    E/AndroidRuntime(374): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
    E/AndroidRuntime(374): at dalvik.system.NativeStart.main(Native Method)
    

    To fix: just have to change folder name from "lib" to "libs".

    See: Issue #2