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/