是否可以使用 Java 8 进行 Android 开发? [英] Is it possible to use Java 8 for Android development?

查看:25
本文介绍了是否可以使用 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 中从窗口菜单 → PreferencesJava 将编译器设置为 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 → PreferencesJavaCompiler. 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 开发?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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