'Could not find method buildscripts() for arguments
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '7.1.2' apply false
id 'com.android.library' version '7.1.2' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
buildscripts {
repositories {
google()
}
dependancies {
classpath 'com.google.gms:google-services:4.3.10'
}
}
allprojects {
repositories {
google()
}
}
The above code is my project level gradle.build file. The error that keeps occurring is that it is not able to find a method known as buildscripts(). I have very little experience with gradle and have almost 0 idea what I could even try.
Solution 1:[1]
In your Gradle file, all buildscript {} blocks must appear before any plugins {} blocks in the script. So your file should look like this:
buildscripts { //? Added on top of the file.
repositories {
google()
}
dependancies {
classpath 'com.google.gms:google-services:4.3.10'
}
}
plugins {
id 'com.android.application' version '7.1.2' apply false
id 'com.android.library' version '7.1.2' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
allprojects {
repositories {
google()
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Alex Mamo |
