乔达时2.1和Android - 的NoClassDefFoundError [英] Joda-Time 2.1 and Android - NoClassDefFoundError

查看:165
本文介绍了乔达时2.1和Android - 的NoClassDefFoundError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试使用的DateTime 在一个Android应用程序(API 15),但得到的的logcat 如下:

Trying to use DateTime in an Android app (API 15) but get the following in logcat:

E/dalvikvm(794): Unable to resolve Lorg/joda/time/base/AbstractInstant; annotation class 1383
D/AndroidRuntime(794): Shutting down VM
W/dalvikvm(794): threadid=1: thread exiting with uncaught exception (group=0x409c01f8)
E/AndroidRuntime(794): FATAL EXCEPTION: main
E/AndroidRuntime(794): java.lang.NoClassDefFoundError: org/joda/convert/ToString
E/AndroidRuntime(794):  at java.lang.reflect.Method.getDeclaredAnnotations(Native Method)
E/AndroidRuntime(794):  at java.lang.reflect.Method.getDeclaredAnnotations(Method.java:267)
E/AndroidRuntime(794):  at com.fasterxml.jackson.databind.introspect.AnnotatedClass._addMixUnders(AnnotatedClass.java:999)
....

我有一个/ libs目录,它有乔达时间,2.1.jar。我失去了一些东西明显?

I have a /libs directory and it has joda-time-2.1.jar. Am I missing something obvious?

我应该多看仔细错误堆栈 - 尤其是该行: java.lang.NoClassDefFoundError的:组织/乔达/转换/的ToString

I should have looked more carefully at the error stack - in particular the line: java.lang.NoClassDefFoundError: org/joda/convert/ToString

这是从罐子里乔达-转换,不乔达时间和乔达-转换jar文件是不是在我的libs目录。

That is from the jar joda-convert, not joda-time and the joda-convert jar file was NOT in my libs directory.

注:似乎有不为任何需要显式导出的jar

Note: There doesn't seem to be any need to explicitly export the jar

推荐答案

您需要将乔达-convert.jar添加到您的libs文件夹。从 http://sourceforge.net/projects/joda-convert/下载JAR文件/乔达-转换/

You need to add the joda-convert.jar to your libs folder. Download the jar from http://sourceforge.net/projects/joda-convert/files/joda-convert/

这篇关于乔达时2.1和Android - 的NoClassDefFoundError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆