我需要在我的Android项目中添加一些外部jar。所以我用谷歌搜索了最好的方法。我完成了需要做的事情:
但我仍然得到NoClassDefFoundError。请帮我。我需要知道如何解决这个问题。感谢。
这是Logcat:
04-09 00:14:54.799: D/AndroidRuntime(1673): Shutting down VM
04-09 00:14:54.799: W/dalvikvm(1673): threadid=1: thread exiting with uncaught exception (group=0x40a661f8)
04-09 00:14:54.803: E/AndroidRuntime(1673): FATAL EXCEPTION: main
04-09 00:14:54.803: E/AndroidRuntime(1673): java.lang.NoClassDefFoundError: javax.activation.DataHandler
04-09 00:14:54.803: E/AndroidRuntime(1673): at com.example.easyMail3.GmailSender.sendMail(GmailSender.java:53)
04-09 00:14:54.803: E/AndroidRuntime(1673): at com.example.easyMail3.EasyMail3Activity.onCreate(EasyMail3Activity.java:18)
04-09 00:14:54.803: E/AndroidRuntime(1673): at android.app.Activity.performCreate(Activity.java:4465)
04-09 00:14:54.803: E/AndroidRuntime(1673): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
04-09 00:14:54.803: E/AndroidRuntime(1673): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
04-09 00:14:54.803: E/AndroidRuntime(1673): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
04-09 00:14:54.803: E/AndroidRuntime(1673): at android.app.ActivityThread.access$600(ActivityThread.java:123)
04-09 00:14:54.803: E/AndroidRuntime(1673): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
04-09 00:14:54.803: E/AndroidRuntime(1673): at android.os.Handler.dispatchMessage(Handler.java:99)
04-09 00:14:54.803: E/AndroidRuntime(1673): at android.os.Looper.loop(Looper.java:137)
04-09 00:14:54.803: E/AndroidRuntime(1673): at android.app.ActivityThread.main(ActivityThread.java:4424)
04-09 00:14:54.803: E/AndroidRuntime(1673): at java.lang.reflect.Method.invokeNative(Native Method)
04-09 00:14:54.803: E/AndroidRuntime(1673): at java.lang.reflect.Method.invoke(Method.java:511)
04-09 00:14:54.803: E/AndroidRuntime(1673): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
04-09 00:14:54.803: E/AndroidRuntime(1673): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
04-09 00:14:54.803: E/AndroidRuntime(1673): at dalvik.system.NativeStart.main(Native Method)
答案 0 :(得分:-1)
在Eclipse中,如果它是一个webproject,保留你的jar的基本位置在WEB-INF的lib文件夹下。 如果它是JavaProject,请确保在BuildPath(库)中找到您的库
如果你确定它们被正确放置,那么你真的没有得到正确的jar文件。