简体   繁体   English

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

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

That is my code, and when那是我的代码,什么时候在此处输入图像描述 try to sync, I get this error:尝试同步,我收到此错误:

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{
        ^

Instead of putting the builscript at line 12而不是将 builscript 放在第 12 行

put it at line 1放在第 1 行

Refer this official docs External dependencies for the build script参考这个官方文档External dependencies for the build script

If you are getting google repo error, try to remove google() under repositories and use mavenCentral()如果您收到 google repo 错误,请尝试删除存储库下的 google() 并使用 mavenCentral()

In addition with Dickens AS Answer, you need to change this configuration in settings.gradle(Project Settings)除了使用 Dickens AS Answer 之外,您还需要在 settings.gradle(Project Settings) 中更改此配置

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

you can use this: repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)你可以使用这个:repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)

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

相关问题 我如何让 usestate 在更新其值之前等待响应 - how do i make usestate wait for a response before updating its value 在返回所有异步函数以更新 firestore 文档之前,如何等待 NodeJS 中的多个异步函数? - How do I wait for multiple async functions in NodeJS before returning them all to update a firestore document? 如何确保我的通知声音在所有设备上都能可靠地播放? - How do I make sure my notification sounds play reliably on all devices? 为什么 Gitlab 上出现所有环境停止? - Why do All Environments Appear Stopped on Gitlab? 如何在警报对话框中构建搜索用户列表? - How do I build a searched list of users inside of an alert dialog? 如何使用 Firebase 身份验证制作受保护的网页/面板? - How do I make a protected webpage/panel with Firebase authentication? 在检查列表包含的内容之前,如何确保列表已填充? - How do I ensure that the list is populated before checking what it contains? 如何从 SQS 队列中获取所有消息 - How do I get All the mesages from the SQS queue 如何从 kubeflow 并行 for 循环收集所有输出? - How do I collect all outputs from a kubeflow parallel for loop? 如何删除 Google Cloud Firestore 中项目的所有 collections? - How do I delete ALL collections for a project in Google Cloud Firestore?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM