简体   繁体   English

NoClassDefFoundError异常Android应用

[英]NoClassDefFoundError Exception Android app

I've been trying to use Sendgrid in my android application. 我一直在尝试在Android应用程序中使用Sendgrid。 It's a project I'm working on with 3 others. 这是我正在与其他3个人合作的项目。 The application works just fine on their phones and emulators, but it always seems to crash on my emulator and phone with this error message 该应用程序在他们的手机和仿真器上都可以正常运行,但似乎总是在我的仿真器和手机上崩溃并显示此错误消息

05-07 03:15:12.940: W/EGL_emulation(1336): eglSurfaceAttrib not implemented
05-07 03:15:13.510: D/onDestroy(1336): 2014-05-07 03:15:11
05-07 03:15:13.700: D/dalvikvm(1336): GC_CONCURRENT freed 338K, 33% free 3276K/4820K, paused 5ms+4ms, total 65ms
05-07 03:15:13.790: E/dalvikvm(1336): Could not find class 'com.github.sendgrid.SendGrid', referenced from method edu.upenn.capsproject.SurveyActivity$SendEmailWithSendGrid.doInBackground
05-07 03:15:13.790: W/dalvikvm(1336): VFY: unable to resolve new-instance 744 (Lcom/github/sendgrid/SendGrid;) in Ledu/upenn/capsproject/SurveyActivity$SendEmailWithSendGrid;
05-07 03:15:13.790: D/dalvikvm(1336): VFY: replacing opcode 0x22 at 0x0001
05-07 03:15:13.790: D/dalvikvm(1336): DexOpt: unable to opt direct call 0x1505 at 0x07 in Ledu/upenn/capsproject/SurveyActivity$SendEmailWithSendGrid;.doInBackground
05-07 03:15:13.800: W/dalvikvm(1336): threadid=11: thread exiting with uncaught exception (group=0x40a71930)
05-07 03:15:13.810: E/AndroidRuntime(1336): FATAL EXCEPTION: AsyncTask #1
05-07 03:15:13.810: E/AndroidRuntime(1336): java.lang.RuntimeException: An error occured while executing doInBackground()
05-07 03:15:13.810: E/AndroidRuntime(1336):     at android.os.AsyncTask$3.done(AsyncTask.java:299)
05-07 03:15:13.810: E/AndroidRuntime(1336):     at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352)
05-07 03:15:13.810: E/AndroidRuntime(1336):     at java.util.concurrent.FutureTask.setException(FutureTask.java:219)
05-07 03:15:13.810: E/AndroidRuntime(1336):     at java.util.concurrent.FutureTask.run(FutureTask.java:239)
05-07 03:15:13.810: E/AndroidRuntime(1336):     at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
05-07 03:15:13.810: E/AndroidRuntime(1336):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
05-07 03:15:13.810: E/AndroidRuntime(1336):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
05-07 03:15:13.810: E/AndroidRuntime(1336):     at java.lang.Thread.run(Thread.java:856)
05-07 03:15:13.810: E/AndroidRuntime(1336): Caused by: java.lang.NoClassDefFoundError: com.github.sendgrid.SendGrid
05-07 03:15:13.810: E/AndroidRuntime(1336):     at edu.upenn.capsproject.SurveyActivity$SendEmailWithSendGrid.doInBackground(SurveyActivity.java:368)
05-07 03:15:13.810: E/AndroidRuntime(1336):     at edu.upenn.capsproject.SurveyActivity$SendEmailWithSendGrid.doInBackground(SurveyActivity.java:1)
05-07 03:15:13.810: E/AndroidRuntime(1336):     at android.os.AsyncTask$2.call(AsyncTask.java:287)
05-07 03:15:13.810: E/AndroidRuntime(1336):     at java.util.concurrent.FutureTask.run(FutureTask.java:234)
05-07 03:15:13.810: E/AndroidRuntime(1336):     ... 4 more
05-07 03:15:15.219: W/EGL_emulation(1336): eglSurfaceAttrib not implemented
05-07 03:15:16.289: I/Process(1336): Sending signal. PID: 1336 SIG: 9
05-07 03:15:16.750: E/Trace(1362): error opening trace file: No such file or directory (2)

I have the sendgrid-0.2.0-jar.jar.zip file in the referenced libraries path. 我在引用的库路径中有sendgrid-0.2.0-jar.jar.zip文件。

Go to Project/Properties/Java Build Path/Order and Export -- Make sure there's a check in front of Android Dependencies and the support library, if you use it. 转到项目/属性/ Java Build Path / Order and Export-确保在使用Android Dependencies和支持库之前已进行检查。 Mark all checkboxes and Click on Apply and clean the project. 选中所有复选框,然后单击“应用”并清理项目。

Copied from my answer on this post 从我对此帖子的回答中复制

Hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM