'buildSrc' cannot be used as a project name as it is a reserved name
Asked Answered
F

4

28

After I upgrade my gradle gradle-5.4.1 to gradle-6.3, I got an error like 'buildSrc' cannot be used as a project name as it is a reserved name. I'm using buidleSrc for Gradle Dependency Management(link). I dont know how to solve this issue please help on this.

enter image description here

Fusty answered 15/4, 2020 at 9:37 Comment(0)
J
54

tldr: Remove "buildSrc" from settings.gradle / settings.gradle.kts. With gradle update, "buildSrc" is now reserved project name.

If you are looking an answer for Android, this should be helpful:

  1. Open your settings.gradle / settings.gradle.kts
  2. Remove "buildSrc" from included modules
  3. Rebuild

Example:

settings.gradle.kts might look like this (syntax will be different for settings.gradle)

include(":app")
rootProject.name = "yourapp"
include(":moduleA")
include(":buildSrc")
include(":moduleB")
include(":moduleC")

remove the line that includes "buildSrc" like:

include(":app")
rootProject.name = "yourapp"
include(":moduleA")
include(":moduleB")
include(":moduleC")

and rebuild project.

Jerry answered 29/4, 2020 at 17:13 Comment(1)
This gets my vote! Thanks for answering. So, in a nutshell I added a module like the kmm setup from kampkit for keeping my dependencies separate and clean. And started getting this erorr. Now it is fine, and all links work perfectly after module is removed as an include module dependency.Lactometer
O
8

just remove include ':buildSrc' from the settings.gradle file and everything will go well.

Odo answered 26/7, 2021 at 11:39 Comment(0)
A
5

This is a change introduced in Gradle 6.0 that made buildSrc a reserved project name.

It means you have a reference to buildSrc as a project in your settings.gradle(.kts). The reference will look like:

  • include("buildSrc")
  • includeBuild("buildSrc")

I would recommend to start by removing that reference and see if it fixes the issue. If not, it means your project was wired differently and you simply have to rename it.

Ambiguous answered 15/4, 2020 at 12:23 Comment(1)
sorry, can you elaborate more. what reference I need to remove ?.Fusty
P
0

This is mentioned in #2 of the answer from HBB20, but I didn't catch it my first few times: Also remove references to buildSrc from all your modules, for example this line:

implementation(project(":buildSrc"))
Pompea answered 2/11, 2023 at 2:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.