swapnil
swapnil

Reputation: 13

Gradle DSL method not found: 'compile'

When I sync the gradle files it is showing the error :

Error:(26, 0) Gradle DSL method not found: 'ompile()'

Possible causes:

  • The project 'Athletto' may be using a version of Gradle that does not contain the method. Open Gradle wrapper file
  • The build file may be missing a Gradle plugin. Apply Gradle plugin
  • I searched for various solutions but none of them worked.I don't know which plugin I have to use.Here are my gradle files :

    build.gradle (Module ) :

                apply plugin: 'com.android.application'
    
            android {
                compileSdkVersion 23
                buildToolsVersion "23.0.2"
    
                defaultConfig {
                    applicationId "com.example.hp.athletto"
                    minSdkVersion 16
                    targetSdkVersion 16
                    multiDexEnabled=true
                    versionCode 1
                    versionName "1.0"
                }
                buildTypes {
                    release {
                        minifyEnabled false
                        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
                    }
                }
            }
    
            dependencies {
                compile fileTree(dir: 'libs', include: ['*.jar'])
                compile 'com.android.support:appcompat-v7:23.1.1'
                ompile 'com.android.support:design:23.0.1'
                compile 'com.github.vajro:MaterialDesignLibrary:1.6'
                compile 'com.android.support:cardview-v7:23.2.0'
                compile('com.github.afollestad.material-dialogs:commons:0.8.5.6@aar') {
                    transitive = true
                }
            }
    

    build.gradle ( Project) :

                // Top-level build file where you can add configuration options common to all sub-projects/modules.
    
            buildscript {
                repositories {
                    jcenter()
                }
                dependencies {
                    classpath 'com.android.tools.build:gradle:2.1.0-alpha1'
                }
            }
    
            allprojects {
                repositories {
                    jcenter()
                    mavenCentral()
                }
            }
    

    Upvotes: 0

    Views: 1142

    Answers (1)

    T D Nguyen
    T D Nguyen

    Reputation: 7603

    You have a typing error: change ompile to compile 'com.android.support:design:23.0.1' on line 3 of dependencies.

    dependencies {
                compile fileTree(dir: 'libs', include: ['*.jar'])
                compile 'com.android.support:appcompat-v7:23.1.1'
                ompile 'com.android.support:design:23.0.1'//<--error here
                compile 'com.github.vajro:MaterialDesignLibrary:1.6'
                compile 'com.android.support:cardview-v7:23.2.0'
                compile('com.github.afollestad.material-dialogs:commons:0.8.5.6@aar') {
                    transitive = true
                }
            }
    

    Upvotes: 1

    Related Questions