As of the 7.X.X gradle build tools. allprojects is deprecated use of dependencyResolutionManagement is the best practice for declaring repositories in every subproject of your build. Because of this Android projects will no longer generate with allprojects blocks in their project build.gradle files. It will instead generate a dependencyResolutionManagement block in settings.gradle.
You shouldn't experince any issues if you use dependencyResolutionManagement
to achieve the same result as an allprojects block. You can add repositories to the dependencyResolutionManagement repositories block just like you would with an allprojects block like so
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
jcenter() // Warning: this repository is going to shut down soon
// e.g this is how you would add jitpack
maven { url "https://jitpack.io" }
// Add any repositories you would be adding to all projects here
}
}
If you would like to use the old way
Remove the whole dependencyResolutionManagement block from your settings.gradle so that it looks like
rootProject.name = "My Application"
include ':app'
Then add the the allproject block to your project build.gradle and make sure to add all of the dependencies that were in your dependencyResolutionManagement so in our example it would look like
allprojects {
repositories {
google()
mavenCentral()
jcenter() // Warning: this repository is going to shut down soon
// e.g this is how you would add jitpack
maven { url "https://jitpack.io" }
// Add any repositories you would be adding to all projects here
}
}