twitter4j =>AndroidRuntime(446): java.lang.NoClassDefFoundError: twitter4j.http.AccessToken [英] twitter4j => AndroidRuntime(446): java.lang.NoClassDefFoundError: twitter4j.http.AccessToken

查看:26
本文介绍了twitter4j =>AndroidRuntime(446): java.lang.NoClassDefFoundError: twitter4j.http.AccessToken的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将 twitter4j 用于我的应用程序来连接和发布到 twitter.我正在关注 本教程.我已经从 这里 下载了示例项目,并尝试在 android 2.3.3 上运行它代码>.我确信我已经根据我的 twitter 开发者网站正确修改了 Constants.java 文件.在 TwitterUtils.java 中,我也输入了 OAUTH_TOKENOAUTH_TOKEN_SECRET.但运行后,我收到以下错误消息:

I am trying to use twitter4j for my app to connect and post to twitter. I am following this tutorial. I have downloaded the example project from here and try to run it on android 2.3.3. I am sure that i have modified Constants.java file correctly according to my twitter developer website. In TwitterUtils.java i have enter OAUTH_TOKEN and OAUTH_TOKEN_SECRET also. but after running it, i got 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)

我不确定我是否错了,在 Constant.java 中,我没有在

am not sure if i am wrong, in Constant.java, i haven't change anything in

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

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

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

public static final String OAUTH_CALLBACK_SCHEME = "x-oauthflow-twitter";

public static final String OAUTH_CALLBACK_HOST = "callback";

public static final String OAUTH_CALLBACK_URL = OAUTH_CALLBACK_SCHEME + "://" + OAUTH_CALLBACK_HOST;

我尝试将 "callback" 更改为 "http://www.MyWebsite.com"请建议我如何解决这些问题.

I have tried changing "callback" with "http://www.MyWebsite.com" Please advice how can I correct these problems.

推荐答案

您需要将文件夹名称从 lib 更改为 libs,因为您已更新 ADT 17.

You need to change your Folder name from lib to libs as you have updated ADT 17.

查看这篇文章 有关此主题的详细信息.

Checkout this Article for in detail information on this topic.

这篇关于twitter4j =>AndroidRuntime(446): java.lang.NoClassDefFoundError: twitter4j.http.AccessToken的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆