android - build.gradle中的android.enableSeparateAnnotationProcessing设置标志

标签 android android-studio gradle android-gradle-plugin build.gradle

Android Studio中有一个新标记,它仍是试验性android.enableSeparateAnnotationProcessing。不幸的是,它在Mac上为我们产生了错误,但在Windows上却可以正常使用。

我可以在build.gradle文件中以编程方式设置该标志,以便在Windows上将其设置为true,否则可以设置为false吗?

如果不可能,是否可以在local.properties文件中设置标志?当我在机器上将它设置为true时,我不希望它一直显示在git的更改文件中。

最佳答案

Google在Android Gradle plugin release notes中解释如下:

Improved incremental Java compilation when using annotation processors: This update decreases build time by improving support for incremental Java compilation when using annotation processors.

Note: This feature is compatible with Gradle 4.10.1 and higher, except Gradle 5.1 due to Gradle issue 8194.


在您的情况下:

For projects not using Kapt (Java-only projects): If the annotation processors you use all support incremental annotation processing, incremental Java compilation is enabled by default. To monitor incremental annotation processor adoption, watch Gradle issue 5277.

If, however, one or more annotation processors do not support incremental builds, incremental Java compilation is not enabled. Instead, you can include the following flag in your gradle.properties file:

android.enableSeparateAnnotationProcessing=true

When you include this flag, the Android Gradle plugin executes the annotation processors in a separate task and allows the Java compilation task to run incrementally.

关于android - build.gradle中的android.enableSeparateAnnotationProcessing设置标志,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55232137/

相关文章:

android - 在以下位置找不到带有哈希字符串 'android-25'的目标:/home/hisham/Android/Sdk

android - 添加新列后如何使用 activeandroid 更新表

java - 无法解析方法;可能的依赖性问题

android - Activity 构建变体没有测试 Artifact

android - 不推荐使用 RegisterResGeneratingTask,使用 registerGeneratedFolders(FileCollection)

java - Fragment 中的自定义 listView。未找到布局

android - Google Speech API示例,无法解析R

android - 在 android 中快速滚动时避免滑动刷新

java - 如何在android中插入%20代替空格

java - Kevin Brothaler OpenGL ES 2教程代码有错?