如何在Android Studio中启用Jack(Java Android Compiler Kit) [英] How to enable Jack (Java Android Compiler Kit) in android studio
问题描述
我更新了 androidstudio 2.1 稳定版本。按照 Android Studio 2.1支持Android N开发人员预览
Android Studio 2.1支持 Jack(Java Android编译器套件)编译器。
I am updated my androidstudio 2.1 stable.As per Android Studio 2.1 supports Android N Developer Preview Android studio 2.1 support Jack (Java Android Compiler Kit) compiler .
如何在android studio中添加或使用Jack?
How to add or use Jack in android studio?
注意:
按照 Android上的Java 8语言功能支持。但是,您可以继续使用它来启用Java 8语言功能,直到
The Jack toolchain is deprecated, as per Java 8 Language Feature Support on Android. However, you may continue to use it to enable Java 8 language features until the replacement is available.
自2017年3月14日发布公告以来,杰克工具链已弃用。 Jack是Android 6.0–8.1的默认Android构建工具链。
As of this March 14, 2017 announcement, the Jack toolchain is deprecated. Jack was the default Android build toolchain for Android 6.0–8.1.
https://source.android.com/source/jack
推荐答案
使用Jack所需的详细信息以及如何在文档。
The details on what is required to use Jack and how can be found in the documentation.
此处是 build.gradle $ c中文档的相关部分$ c>如何使用
jackOptions
并为Java 1.8设置 compileOptions
。
Here is the relevant part from the docs that goes in build.gradle
on how to use jackOptions
and set the compileOptions
for java 1.8.
android {
...
defaultConfig {
...
jackOptions {
enabled true
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
更新
根据< a href = https://android-developers.googleblog.com/2017/03/future-of-java-8-language-feature.html rel = noreferrer>这篇文章,而工作正在进行中据该帖子称,它将在未来几周内原生支持Java 8功能作为Android构建系统的一部分。
The Jack toolchain is now considered deprecated according to this post and work is being done to natively support Java 8 features as part of the Android build system in the coming weeks according to the post.
该帖子还提到应该几乎没有任何工作如果您仍然想尝试使用Jack启用Java 8功能,请从Jack迁移到新方法。
The post also mentions that there should be little to no work migrating from Jack to the new method in case you still wanted to try enabling Java 8 features with Jack.
UPDATE 2 Preview内置支持
您现在可以使用最新的Android Studio预览版2.4预览版6来尝试对Java 8进行新的内置支持。
You can now try out the new built-in support for Java 8 using the latest Android Studio preview 2.4 preview 6.
有关如何启用它或从Jack或Retrolambda迁移的更多信息,请参见文档。
For more information on how to enable it or migrate from Jack or Retrolambda see the documentation.
这篇关于如何在Android Studio中启用Jack(Java Android Compiler Kit)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!