Could not find method classpath() for arguments [com.android.tools.build:gradle:3.3.0] on object of type:

2,679

In your app/build.gradle you have to remove these dependencies:

dependencies {
    classpath 'com.android.tools.build:gradle:3.3.0'  //to be removed
    classpath 'com.google.gms:google-services:4.2.0'  //to be removed
}

In your build.gradle (main folder) you have to add in the buildscript block :

buildscript {
    repositories {
        google()
        //... others
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.0'
        classpath 'com.google.gms:google-services:4.2.0'

        // others...
    }
}
Share:
2,679
ibrahim
Author by

ibrahim

Updated on December 11, 2022

Comments

  • ibrahim
    ibrahim over 1 year

    i have problim when trying to run flutter run in cmd

    • Error running Gradle: ProcessException: Process "xx\android\gradlew.bat" exited abnormally:

    FAILURE: Build failed with an exception.

    • Where: Build file 'xx\android\app\build.gradle' line: 61

    • What went wrong: A problem occurred evaluating project ':app'.

      Could not find method classpath() for arguments [com.android.tools.build:gradle:3.3.0] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

    app/build.gradle

    dependencies {
        testImplementation 'junit:junit:4.12'
        androidTestImplementation 'com.android.support.test:runner:1.0.2'
        androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
        classpath 'com.android.tools.build:gradle:3.3.0'
        classpath 'com.google.gms:google-services:4.2.0'
    
    }
    
    

    build.gradle

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

    gradle.properties

    android.useAndroidX=true
    android.enableJetifier=true
    org.gradle.jvmargs=-Xmx1536M
    
  • Pie
    Pie almost 5 years
    Please look into this question I tried to solve it but could not solve it stackoverflow.com/questions/56513672/… @Gabriele Mariotti