Add a warehouse in allprojects repositories and report an error

Android studio version:
Android studio arctic fox | 2020.3.1 patch 1
build #ai-203.7717.56.2031.7621141, build on August 8, 2021

Gradle version: 7.0.0

Add a new warehouse under the gradle of the project

An error is reported:
build was configured to prefer settings repositories over project repositories but repository ‘Maven’ was added by build file ‘build. Gradle’

Solution
put the library you want to add into setting.gradle

Read More: