Reputation: 247
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)
....
I have a /libs directory and it has joda-time-2.1.jar. Am I missing something obvious?
I should have looked more carefully at the error stack - in particular the line: java.lang.NoClassDefFoundError: org/joda/convert/ToString
That is from the jar joda-convert, not joda-time and the joda-convert jar file was NOT in my libs directory.
Note: There doesn't seem to be any need to explicitly export the jar
Upvotes: 3
Views: 3277
Reputation: 450
You should use joda-time-android. This is jodatime library adapted for android.
Upvotes: 1
Reputation: 7937
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/
Upvotes: 4