Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java.lang.NoClassDefFoundError: Failed resolution of: Ljava/time/LocalTime;

I'm developing an app using Android Studio 2.1.2, API level 23. In a class I used the java.time.LocalTime class, but at runtime an unhanded NoClassDefFoundError exception kills my activity. Googling, I understood that I have to add dependencies in build.gradle because Android classes are developed using a version of JDK older than Java 8 (when the LocalTime class has been added).

So I have to write something like: compile "java.time:LocalTime:1.8"

But it doesn't work.

like image 386
Daniele Avatar asked Aug 29 '16 20:08

Daniele


Video Answer


1 Answers

The Android runtime supports a limited subset of the standard library enhancements made in JDK 8. The JDK 8 date time library is not supported. You can use something like http://www.threeten.org/threetenbp/

like image 137
clay Avatar answered Oct 19 '22 09:10

clay