Going through the documentation of Gradle's build configuration I can see several conflicts with my build on Android Studio 2020.3.1
using Gradle 7.0.3
.
For example, in the documentation is says that allProjects
block for repositories settings used by all modules should be added to the root build.gradle
while in fact it only allows me to configure modules repositories in the settings.gradle
under dependencyResolutionManagement
block.
Another example is applying plugins to application modules, in documentations it says the first line should be:
apply plugin: 'com.android.application'
While the one used in my build is:
plugins {
id 'com.android.application'
}
What I also noticed is that also JitPack uses the same configurations suggested in that documentations page for using a JitPack published library in projects:
Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Step 2. Add the dependency
dependencies {
implementation 'com.github.arcm111.ScaleNumberPicker:final:1.0.1'
}
So my question is, are these documentation pages outdated, is Gradle 7
not fully supported yet, or am I looking at the wrong documentation?
CodePudding user response:
in the documentation is says that allProjects block for repositories settings used by all modules should be added to the root build.gradle while in fact it only allows me to configure modules repositories in the settings.gradle under dependencyResolutionManagement block.
You may wish to ask a separate Stack Overflow question with a minimum verifiable example and details of your errors. This GitLab repo, in tag v2.2
contains a multi-module Android Studio project using Gradle 7.0.2 that uses allProjects
for configuring repositories.
Another example is applying plugins to application modules, in documentations it says the first line should be... While the one used in my build is
Either syntax works. The plugins
approach has been available for a year or so in Android Studio projects. The project that I linked to above uses the older apply plugin
syntax. This sample project, by contrast, uses plugins
.
are these documentation pages outdated, is Gradle 7 not fully supported yet, or am I looking at the wrong documentation?
None of the above, AFAICT. allProjects
and apply plugin
still work, at least with Gradle 7.0.2.