Android Studio 3.0中的java.time在哪里? [英] Where is java.time in Android Studio 3.0?

查看:161
本文介绍了Android Studio 3.0中的java.time在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据Android Studio文档:

According to Android Studio documentation:

Android Studio 3.0引入了对Java 8库的内置支持

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

但是Java 8的巨大改进是使用了新的 java.time 库.目前,该库似乎未包含在该版本中.

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.

所以我的问题是:我错了吗?如果没有,是否有任何变通办法可以在Android应用程序中使用此库?

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

推荐答案

要获得在Android Studio中运行的Java 8语言功能支持,请检查以下四件事:

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

  1. 确保您正在运行最新版本的Android Studio 3.0

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

确保您正在使用嵌入式JDK

Ensure you are using the embedded JDK

更新您的来源并 目标兼容性版本在您的项目结构中为1.8.

Update your the source and target compatibility versions to 1.8 in your project structure.

确保minSdkVersion为24(或26/'O',具体取决于哪种方法 您要在课程中使用的内容)

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

一旦您的项目符合这些设置,就可以将诸如 import java.time.LocalDateTime; 的库添加到您的项目中.请查看此页面以获取更多信息: https://developer.android. com/studio/preview/features/java8-support.html

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

这篇关于Android Studio 3.0中的java.time在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆