我想使用具有此语法的gradle插件
plugins {
id "id" version "version"
}
Run Code Online (Sandbox Code Playgroud)
但我有错误
only build script and other plugins script blocks are allowed before plugins
Run Code Online (Sandbox Code Playgroud)
我把它移到了bloc buildscript但仍然没有工作.
我该如何应用这种插件?
这是我想要包含在我的项目中的插件
这是我的gradle版本的输出
Gradle 4.3.1
------------------------------------------------------------
Build time: 2017-11-08 08:59:45 UTC
Revision: e4f4804807ef7c2829da51877861ff06e07e006d
Groovy: 2.4.12
Run Code Online (Sandbox Code Playgroud)
Luk*_*fer 26
无论何时编写build.gradle脚本并使用新plugins脚本块,都需要将其作为文件中的第一个块.此规则的唯一例外是其他plugins块或特殊buildScript块,它们必须首先出现.
举个例子,这个脚本很好:
plugins {
// ...
}
dependencies {
// ...
}
Run Code Online (Sandbox Code Playgroud)
这个也很好:
buildScript {
// ...
}
plugins {
// ...
}
repositories {
// ...
}
Run Code Online (Sandbox Code Playgroud)
但是这个是无效的:
repositories {
// ...
}
plugins {
// ...
}
Run Code Online (Sandbox Code Playgroud)
小智 6
我注意到 android 块之前有一个插件行,上面写着 apply plugin: 'com.android.application'。由于 firebase 配置要求我提供“com.google.gms.google-services”插件,我只需添加:
apply plugin: 'com.google.gms.google-services'
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7757 次 |
| 最近记录: |