2

I'm getting this particular error and my SDK Manager says the Support Directory is already installed.

`Error:(11, 0) Could not find method compile() for arguments [com.android.support:design:27.0.2] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

Please install the Android Support Repository from the Android SDK Manager.
<a href="openAndroidSdkManager">Open Android SDK Manager</a>`

Thanks in advance!

Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841
Sachin Titus
  • 1,960
  • 3
  • 23
  • 41

3 Answers3

2

You are adding the dependencies in the wrong part.
Don't add the support libraries in the buildscript block and don't add them in the top-level file.

repositories { 
        google() 
        jcenter() 
        maven { url "maven.google.com"; /i added this line } 
     } 
    dependencies { 
        classpath 'com.android.tools.build:gradle:3.0.1' 

        REMOVE THESE LINES !!!

        compile  'com.android.support:appcompat-v7:27.+' //i added this line 
        compile 'com.android.support:design:27.+' // i added this line This is the only place where changes are made
    }
Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841
0

Replacing 27.0.2 with 27.+ is considered bad practice. Make sure that you are adding the dependency in the correct Gradle file app/build.gradle in the dependencies{} block.

Marcus
  • 164
  • 1
  • 13
-1

Make sure that you are adding dependencies in your

project>app>build.gradle

not in your

project>build.gradle

Abhishek kumar
  • 4,347
  • 8
  • 29
  • 44
yuva
  • 1