gpt4 book ai didi

Android Twitter4j 给出错误 NoClassDefFoundError : twitter4j. TwitterFactory

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:06:29 25 4
gpt4 key购买 nike

我正在制作一个与 Twitter 通信以发布推文的应用程序。我的问题是,在编译我的代码时,我收到错误消息:

NoClassDefFoundError: twitter4j.TwitterFactory

这是通过 onClickListener 发布推​​文的代码:

post.setOnClickListener(new View.OnClickListener() {

public void onClick(View v) {
// TODO Auto-generated method stub
Twitter twitter = new TwitterFactory().getInstance();
AccessToken a = new AccessToken("****", "****");
twitter.setOAuthConsumer("****", "****");
twitter.setOAuthAccessToken(a);
try {
twitter.updateStatus("If you're reading this on Twitter, it worked!");
} catch (TwitterException e) {
e.printStackTrace();
}
}
});

这是我在 logcat 中得到的内容:

04-04 10:27:51.330: E/AndroidRuntime(12547): FATAL EXCEPTION: main
04-04 10:27:51.330: E/AndroidRuntime(12547): java.lang.NoClassDefFoundError: twitter4j.TwitterFactory
04-04 10:27:51.330: E/AndroidRuntime(12547): at com.bintuu.updater.TwitterClass$3.onClick(TwitterClass.java:107)
04-04 10:27:51.330: E/AndroidRuntime(12547): at android.view.View.performClick(View.java:2485)
04-04 10:27:51.330: E/AndroidRuntime(12547): at android.view.View$PerformClick.run(View.java:9080)
04-04 10:27:51.330: E/AndroidRuntime(12547): at android.os.Handler.handleCallback(Handler.java:587)
04-04 10:27:51.330: E/AndroidRuntime(12547): at android.os.Handler.dispatchMessage(Handler.java:92)
04-04 10:27:51.330: E/AndroidRuntime(12547): at android.os.Looper.loop(Looper.java:130)
04-04 10:27:51.330: E/AndroidRuntime(12547): at android.app.ActivityThread.main(ActivityThread.java:3683)
04-04 10:27:51.330: E/AndroidRuntime(12547): at java.lang.reflect.Method.invokeNative(Native Method)
04-04 10:27:51.330: E/AndroidRuntime(12547): at java.lang.reflect.Method.invoke(Method.java:507)
04-04 10:27:51.330: E/AndroidRuntime(12547): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
04-04 10:27:51.330: E/AndroidRuntime(12547): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
04-04 10:27:51.330: E/AndroidRuntime(12547): at dalvik.system.NativeStart.main(Native Method)

最佳答案

尝试将“lib”文件夹名称重命名为“libs”。这为我解决了类似的问题,请在此处查看:https://github.com/ddewaele/AndroidTwitterSample/issues/2

关于Android Twitter4j 给出错误 NoClassDefFoundError : twitter4j. TwitterFactory,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10004123/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com