2

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

my build.gradle:app

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion "22.0.1"
defaultConfig {
    applicationId "com.g"
    minSdkVersion 14
    targetSdkVersion 26
    versionCode 83
    versionName "9.2"
}
buildTypes {
    release {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

}

dependencies {
    classpath 'com.android.tools.build:gradle:4.0.0'
    implementation 'com.google.android.gms:play-services-ads:11.0.0'
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:26.1.1'
    implementation 'com.android.support:support-v4:26.2.0'
}
repositories {
    google()
    //... others
}
0

1 Answer 1

6

Remove this line in the app/build.gradle file:

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

and move it in the top-level build.gradle file:

buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath "com.android.tools.build:gradle:4.0.0"
        //....
    }
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.