I found that the repositories{} and allprojects{repositories{}} sections were missing from project build.gradle.
I added them, but now another error says:
Build was configured to prefer settings repositories over project repositories but repository 'Google' was added by build file 'build.gradle'
Mehdi Haghgoo
11/11/2021, 8:32 AM
IDE info: Android Studio Chipmunk | 2021.2.1 Canary 4
Build #AI-212.5284.40.2112.7863073, built on October 28, 2021
Runtime version: 11.0.12+0-b1504.28-7817840 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Linux 5.14.16-301.fc35.x86_64
GC: G1 Young Generation, G1 Old Generation
Memory: 2048M
Cores: 4
Registry: external.system.auto.import.disabled=true
Non-Bundled Plugins: org.jetbrains.kotlin (212-1.6.0-RC2-release-765-AS5457.46)
Current Desktop: GNOME
g
gildor
11/11/2021, 8:50 AM
correct
gildor
11/11/2021, 8:50 AM
looks that you have a project where repositories configured with dependencyResolutionManagement
➕ 1
gildor
11/11/2021, 8:51 AM
and it has setting to prevent adding repositories in a different way (like repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS))
gildor
11/11/2021, 8:51 AM
all those settings are completely valid, check that dependencyResolutionManagement contains google()