gpt4 book ai didi

android - 插件指令在 gradle 文件中的什么位置?

转载 作者:太空宇宙 更新时间:2023-11-03 13:15:53 24 4
gpt4 key购买 nike

我正在使用 Android Studio 和 gradle 开发一个 Android 项目。我从 Gradle 2.1+ 中看到,您可以使用新的插件指令包含插件,如下所示:

plugins {
id "me.tatarka.retrolambda" version "3.2.5"
}

这条指令去哪里了?我必须将它放在哪个 gradle 文件中,嵌套在某个地方或只是附加在末尾?

最佳答案

这就是gradle documentation关于它:

The new plugins {} block does not support arbitrary Groovy code. It is constrained, in order to be idempotent (produce the same result every time) and side effect free (safe for Gradle to execute at any time).

The form is:

plugins { id «plugin id» version «plugin version» }

Where «plugin version» and «plugin id» must be constant, literal, strings. No other statements are allowed; their presence will cause a compilation error.

The plugins {} block must also be a top level statement in the buildscript. It cannot be nested inside another construct (e.g. an if-statement or for-loop).

The plugins {} block can currently only be used in a project's build script. It cannot be used in script plugins, the settings.gradle file or init scripts.

关于android - 插件指令在 gradle 文件中的什么位置?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36174957/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com