Android java.lang.NoClassDefFoundError using JODA libraries

I got stuck in about 2 hours over a problem that, in my opinion, is easy to solve. I am creating a custom time collection for the Android platform, and because of the slowness of the standard classes java.util.Calendar and java.util.Date, I decided to use the JODA library.

Unfortunately, I have no experience with "JAR" links (forgive me ... I came from COM and .NET assemblylies world =) ...), but I find out some tips on the Internet, but obviously they seem , wrong ... These are the steps I took to use the library in my project:

  • Download the latest JODA 2.1 library
  • Create the "lib" folder in the project folder
  • Add 'joda-time-2.1.jar' to the 'lib' folder.
  • Add the library "joda-time-2.1.jar" to the build path.
  • Add 'joda-time-2.1-javadoc.jar' and 'joda-time-2.1-sources.jar' to the 'lib' folder
  • Set the indicated libraries as “java source attributes” and “javadoc location” for the library referenced by joda-time-2.1.
  • Use the new library in my code (ehm ehm 'intelli-sense "and the compiler does not generate any errors or warnings)
  • Run debug on a real or virtual device.

When it comes to the next line (the first that uses JODA BTW), debugging stops:

DateTime newDate = new DateTime(2012, 5, 3, 12, 0, 0);

And it returns the following stack trace:

05-03 19:09:14.349: E/AndroidRuntime(4071): java.lang.NoClassDefFoundError: org.joda.time.DateTime
05-03 19:09:14.349: E/AndroidRuntime(4071):     at it.paganel.droidMessageExport.Control.TimePickerControl.SetTimePart(TimePickerControl.java:83)
05-03 19:09:14.349: E/AndroidRuntime(4071):     at it.paganel.droidMessageExport.Control.TimePickerControl.onClick(TimePickerControl.java:116)
05-03 19:09:14.349: E/AndroidRuntime(4071):     at android.view.View.performClick(View.java:2454)
05-03 19:09:14.349: E/AndroidRuntime(4071):     at android.view.View$PerformClick.run(View.java:9030)
05-03 19:09:14.349: E/AndroidRuntime(4071):     at android.os.Handler.handleCallback(Handler.java:587)
05-03 19:09:14.349: E/AndroidRuntime(4071):     at android.os.Handler.dispatchMessage(Handler.java:92)
05-03 19:09:14.349: E/AndroidRuntime(4071):     at android.os.Looper.loop(Looper.java:123)
05-03 19:09:14.349: E/AndroidRuntime(4071):     at android.app.ActivityThread.main(ActivityThread.java:4641)
05-03 19:09:14.349: E/AndroidRuntime(4071):     at java.lang.reflect.Method.invokeNative(Native Method)
05-03 19:09:14.349: E/AndroidRuntime(4071):     at java.lang.reflect.Method.invoke(Method.java:521)
05-03 19:09:14.349: E/AndroidRuntime(4071):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:870)
05-03 19:09:14.349: E/AndroidRuntime(4071):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:628)
05-03 19:09:14.349: E/AndroidRuntime(4071):     at dalvik.system.NativeStart.main(Native Method)
05-03 19:09:14.349: E/AndroidRuntime(4071): Caused by: java.lang.ClassNotFoundException: org.joda.time.DateTime in loader dalvik.system.PathClassLoader[/data/app/it.paganel.droidMessageExport-2.apk]
05-03 19:09:14.349: E/AndroidRuntime(4071):     at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
05-03 19:09:14.349: E/AndroidRuntime(4071):     at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
05-03 19:09:14.349: E/AndroidRuntime(4071):     at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
05-03 19:09:14.349: E/AndroidRuntime(4071):     ... 13 more

Can anybody help me? Thanks in advance!

+5
source share
2 answers

lib lib. ADT Tools 17 apk, . "configure build path.." → "Order and Export" .

+7

, , , : > a > Java > , JodaTime Android Android. , "" "". Android ( JodaTime), .

, , JodaTime.

+1

All Articles