Is it possible to use Java 8 for Android development?(是否可以使用 Java 8 进行 Android 开发?)
问题描述
在网上搜索,不清楚Android开发是否支持Java 8.
Searching the web, it is not clear if Java 8 is supported for Android development or not.
在我下载/设置 Java 8 之前,有人可以指出我在任何官方"文档中说明 Java 8 是否支持 Android 开发.
Before I download/setup Java 8, can some one point me at any "official" documentation that says Java 8 is or is not supported for Android development.
推荐答案
java 8
Android 支持所有 Java 7 语言功能和 Java 8 语言功能的子集,这些功能因平台版本而异.
java 8
Android supports all Java 7 language features and a subset of Java 8 language features that vary by platform version.
检查支持java 8的哪些特性
To check which features of java 8 are supported
使用 Java 8 语言功能
我们决定将对 Java 8 语言功能的支持直接添加到当前的 javac 和 dx 工具集中,并弃用 Jack 工具链.有了这个新的方向,依赖于 Java 类文件格式的现有工具和插件应该可以继续工作.展望未来,Android 构建系统将原生支持 Java 8 语言功能.我们的目标是在未来几周内将其作为 Android Studio 的一部分推出,我们希望尽早与您分享这一决定.
We've decided to add support for Java 8 language features directly into the current javac and dx set of tools, and deprecate the Jack toolchain. With this new direction, existing tools and plugins dependent on the Java class file format should continue to work. Moving forward, Java 8 language features will be natively supported by the Android build system. We're aiming to launch this as part of Android Studio in the coming weeks, and we wanted to share this decision early with you.
Java 8 语言功能的未来支持安卓
对于喜欢 Eclipse 的老开发者,google 停止支持 Eclipse Android 开发者工具一个>
For old developers who prefer Eclipse, google stops support Eclipse Android Developer tools
如果你安装了 Java 8 JDK,那就试试看,如果出现任何问题,尝试在 Eclipse 中从窗口菜单 → Preferences → Java 将编译器设置为 1.6→ 编译器.Java 7 也可以使用:
if you installed Java 8 JDK, then give it a try, if any problems appears try to set the compiler as 1.6 in Eclipse from window menu → Preferences → Java → Compiler. Java 7 will works too:
Java -> 编译器">
如果您的目标是 Android 5.0 和更高.
Java 7 or higher is required if you are targeting Android 5.0 and higher.
安装多个JDK并尝试.
install multiple JDK and try.
这篇关于是否可以使用 Java 8 进行 Android 开发?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:是否可以使用 Java 8 进行 Android 开发?


基础教程推荐
- 在 Java 中创建日期的正确方法是什么? 2022-01-01
- 如何在 JFrame 中覆盖 windowsClosing 事件 2022-01-01
- 不推荐使用 Api 注释的描述 2022-01-01
- Java Swing计时器未清除 2022-01-01
- 大摇大摆的枚举 2022-01-01
- 验证是否调用了所有 getter 方法 2022-01-01
- 从 python 访问 JVM 2022-01-01
- Java 实例变量在两个语句中声明和初始化 2022-01-01
- 多个组件的复杂布局 2022-01-01
- 如何在 Spring @Value 注解中正确指定默认值? 2022-01-01