HKoncept
HKoncept

Reputation: 152

Where is java.time in Android Studio 3.0?

According to Android Studio documentation:

Android Studio 3.0 introduces built-in support for Java 8 libraries

But a huge improvement in Java 8 is the use of the new java.time library. For now, this library seems not included in this version.

So my question: I'm I wrong ? If not, is there any workaround possible to use this library in Android applications ?

Upvotes: 2

Views: 912

Answers (1)

Jamal Eason
Jamal Eason

Reputation: 6598

To get Java 8 language feature support running in Android Studio, check these four things:

  1. Make sure you are running the latest version of Android Studio 3.0

  2. Ensure you are using the embedded JDKEmbedded JDK setting

  3. Update your the source and target compatibility versions to 1.8 in your project structure.Target Compatibility & minSdkVersion

  4. Ensure you minSdkVersion is 24 (or 26/'O' depending on which method you want to use in the class)

Once your project complies with those settings, you can add libraries such as: import java.time.LocalDateTime; to your project. Check out this page for more information: https://developer.android.com/studio/preview/features/java8-support.html

Upvotes: 2

Related Questions