繁体   English   中英

如何使所有构建脚本出现在插件之前

[英]How do i make all build scripts to appear before plugins

那是我的代码,什么时候在此处输入图像描述 尝试同步,我收到此错误:

Gradle sync failed: Cause: startup failed:
        build file 'C:\Users\user\AndroidStudioProjects\Chiro\build.gradle': 12: all buildscript {} blocks must appear before any plugins {} blocks in the script
        See https://docs.gradle.org/7.2/userguide/plugins.html#sec:plugins_block for information on the plugins {} block
        @ line 12, column 1.
        buildscript{
        ^

而不是将 builscript 放在第 12 行

放在第 1 行

参考这个官方文档External dependencies for the build script

如果您收到 google repo 错误,请尝试删除存储库下的 google() 并使用 mavenCentral()

除了使用 Dickens AS Answer 之外,您还需要在 settings.gradle(Project Settings) 中更改此配置

而不是这个:repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)

你可以使用这个:repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM