症状:我正在使用从创建者的git存储库中提取的项目。我包括了他们的库,如libs文件夹中所示。项目没有错误,将编译该项目。然而,当它访问一个应该在jar中的对象时,它会崩溃。
我在这里读过一些其他的建议。我读到一些关于改变classpath的文章,那是哪里?
另外,jar的src代码显示了有问题的对象是实际存在的….
ConfigurationBuilder configurationBuilder = new ConfigurationBuilder();

05-30 11:26:16.878: E/AndroidRuntime(11098): FATAL EXCEPTION: main
05-30 11:26:16.878: E/AndroidRuntime(11098): java.lang.NoClassDefFoundError:      twitter4j.conf.ConfigurationBuilder
05-30 11:26:16.878: E/AndroidRuntime(11098):    at com.pigmal.android.ex.twitter4j.TwitterApp.askOAuth(TwitterApp.java:110)
05-30 11:26:16.878: E/AndroidRuntime(11098):    at com.pigmal.android.ex.twitter4j.TwitterApp.onClick(TwitterApp.java:144)
05-30 11:26:16.878: E/AndroidRuntime(11098):    at android.view.View.performClick(View.java:2482)
05-30 11:26:16.878: E/AndroidRuntime(11098):    at android.view.View$PerformClick.run(View.java:9077)
05-30 11:26:16.878: E/AndroidRuntime(11098):    at android.os.Handler.handleCallback(Handler.java:587)
05-30 11:26:16.878: E/AndroidRuntime(11098):    at a ndroid.os.Handler.dispatchMessage(Handler.java:92)
05-30 11:26:16.878: E/AndroidRuntime(11098):    at android.os.Looper.loop(Looper.java:130)
05-30 11:26:16.878: E/AndroidRuntime(11098):    at android.app.ActivityThread.main(ActivityThread.java:3683)
05-30 11:26:16.878: E/AndroidRuntime(11098):    at java.lang.reflect.Method.invokeNative(Native Method)
05-30 11:26:16.878: E/AndroidRuntime(11098):    at java.lang.reflect.Method.invoke(Method.java:507)
05-30 11:26:16.878: E/AndroidRuntime(11098):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
05-30 11:26:16.878: E/AndroidRuntime(11098):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
05-30 11:26:16.878: E/AndroidRuntime(11098):    at dalvik.system.NativeStart.main(Native Method)

这是我完整的项目设置。使用Android的事实可能不相关,我不想通过标记Android来疏离Java专家。
java - NoClassDefFoundError,这里忽略了什么? (附图片)-LMLPHP

最佳答案

这解决了我的问题http://android.foxykeep.com/dev/how-to-fix-the-classdefnotfounderror-with-adt-17

What I did to fix the bug was :

Remove the libraries from the standard Java build path :
Right click on the project name > Properties > Java Build Path > tab Libraries > remove      everything except the “Android X.X” (2.3.3 in my case) and the “Android Dependencies”
Rename the libraries folder from “lib” to “libs”
By doing that, all the libraries in the folder “libs” are found by the Android plugin and   are added to the “Android Dependencies” item of the project
Restart Eclipse
Android Dependencies should be created. Running the app won't produce NoClassDefFoundError anymore

例外的是,我必须在遵循这些指令之后重新启动eclipse,而不是仅仅在之后清理项目。

07-27 23:23