问题描述
我更新到最新的Android N sdk。我唯一不理解的是为什么我不能将 java.time
导入到我的代码中?我认为Java8是通过Android N提供的。那么为什么Google没有添加 java.time
包?
I updated to the latest Android N sdk. The only thing I don't understand is why I cannot import java.time
into my code? I thought Java8 is available through Android N. Then why didn't Google add java.time
package?
推荐答案
Android N不支持Java 8的所有功能。
仅支持以下功能:
Android N is not supporting all the features of Java 8.Following features are only supported:
- 默认和静态接口方法
- Lambda表达式
- 可重复注释
反思和与语言相关的API:
Reflection and language-related APIs:
-
java.lang.FunctionalInterface
-
java.lang.annotation.Repeatable
-
java.lang.reflect.Method.isDefault()
java.lang.FunctionalInterface
java.lang.annotation.Repeatable
java.lang.reflect.Method.isDefault()
和与可重复注释相关的Reflection API ,例如
AnnotatedElement.getAnnotationsByType(Class)
and Reflection APIs associated with repeatable annotations, such asAnnotatedElement.getAnnotationsByType(Class)
实用程序API:
-
java.util.function
java.util.function
有关详细信息,请查看以下链接:
For more info check the following link: http://developer.android.com/preview/j8-jack.html
这篇关于Android N Java8 java.time的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!