如何解决此NoClassDefFoundError。
我已将Zxing集成到我的应用程序中,一切正常。然后我更新了sdk和eclipse插件,当我运行项目时,日志显示

03-27 17:27:45.173: E/AndroidRuntime(8917): FATAL EXCEPTION: main
03-27 17:27:45.173: E/AndroidRuntime(8917): java.lang.ExceptionInInitializerError
03-27 17:27:45.173: E/AndroidRuntime(8917):     at java.lang.Class.newInstanceImpl(Native Method)
03-27 17:27:45.173: E/AndroidRuntime(8917):     at java.lang.Class.newInstance(Class.java:1429)
03-27 17:27:45.173: E/AndroidRuntime(8917):     at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
03-27 17:27:45.173: E/AndroidRuntime(8917):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
03-27 17:27:45.173: E/AndroidRuntime(8917):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
03-27 17:27:45.173: E/AndroidRuntime(8917):     at android.app.ActivityThread.access$2300(ActivityThread.java:125)
03-27 17:27:45.173: E/AndroidRuntime(8917):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
03-27 17:27:45.173: E/AndroidRuntime(8917):     at android.os.Handler.dispatchMessage(Handler.java:99)
03-27 17:27:45.173: E/AndroidRuntime(8917):     at android.os.Looper.loop(Looper.java:123)
03-27 17:27:45.173: E/AndroidRuntime(8917):     at android.app.ActivityThread.main(ActivityThread.java:4627)
03-27 17:27:45.173: E/AndroidRuntime(8917):     at java.lang.reflect.Method.invokeNative(Native Method)
03-27 17:27:45.173: E/AndroidRuntime(8917):     at java.lang.reflect.Method.invoke(Method.java:521)
03-27 17:27:45.173: E/AndroidRuntime(8917):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
03-27 17:27:45.173: E/AndroidRuntime(8917):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
03-27 17:27:45.173: E/AndroidRuntime(8917):     at dalvik.system.NativeStart.main(Native Method)
03-27 17:27:45.173: E/AndroidRuntime(8917): Caused by: java.lang.NoClassDefFoundError: com.google.zxing.ResultMetadataType
03-27 17:27:45.173: E/AndroidRuntime(8917):     at records.model.CaptureActivity.<clinit>(CaptureActivity.java:94)`

最佳答案

我不必将jar库放入 Assets 或库中,而只需在Properties-> Java Build Path->“Order and Export”中选中该jar的框(之前已列出,但未选中)

您可能必须做一个项目>清理后才能生效! (感谢mwengler和Mohamed)

关于android - 更新sdk的Zxing收到NoClassDefFoundError,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/9889737/

10-12 03:21