According to Android Studio documentation:
Android Studio 3.0 introduces built-in support for Java 8 libraries
But a huge impro
To get Java 8 language feature support running in Android Studio, check these four things:
Make sure you are running the latest version of Android Studio 3.0
Ensure you are using the embedded JDK
Update your the source and target compatibility versions to 1.8 in your project structure.
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