alireza
alireza

Reputation: 33

Could not find method classpath() error

when I try to compile my project in Android Studio 3:

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

this is my build.gradle (Module:app):

apply plugin: 'com.android.application'
 android {
  compileSdkVersion 26
  buildToolsVersion '27.0.3'
  defaultConfig {
   applicationId "ir.chistaapplication.www.myapplication20"
   minSdkVersion 15
   targetSdkVersion 26
   versionCode 1
   versionName "1.0"
   testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
  }
  buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
  }
 }
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.0.1'
}

Upvotes: 2

Views: 3795

Answers (1)

Leo Aso
Leo Aso

Reputation: 12463

Don't put classpath dependencies inside app/build.gradle. Put them inside the buildScript dependencies in your project build.gradle

buildScript {
    dependencies  {
        // here
    }
}

Upvotes: 3

Related Questions