I cound'nt find buildscript in build.gradle(Project)

Viewed 3296

This is build.gradle(Project) what i knew.

buildscript {

    repositories {
        google()
        jcenter()
    }


    dependencies {
        classpath 'com.android.tools.build:gradle:7.0.0'
    }
}


allprojects {
    repositories {
        google()
        jcenter()
    }
}

But my Project's build.gradle(Project) is that.

// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
    id 'com.android.application' version '7.1.1' apply false
    id 'com.android.library' version '7.1.1' apply false
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

I tried to link Firebase with Android, but build.gradle(Project) was different from the file I knew.
I tried to modify it by force, but it didn't sync...
How can I access the Top-Level Gradle file??

3 Answers

For Android Studio Bumblebee they are changed build.gradle structure.

You can add your buildscript above plugins

buildscript {
  dependencies {
    // Add our classpath 
     classpath 'com.google.gms:google-services:4.3.10'
    // Add More 
 }
}
 plugins {
      id 'com.android.application' version '7.1.0' apply false
      id 'com.android.library' version '7.1.0' apply false
}

task clean(type: Delete) {
   delete rootProject.buildDir
}

Try classpath 'com.android.tools.build:gradle:7.1.1' for Android Studio Bumblebee; Android Studio Arctic Fox still uses AGP up to 7.0.4. In every case, you cannot add version 7.0.0 to class-path, but then use version 7.1.1. These version numbers need to match. Most likely the Gradle wrapper also needs to be updated. Maybe think about version control once ...because one could basically sum up the question as "I've deleted a file, what now?"

Please Check your Setting.gradle file.

Related