0

I am new in Android studio.

I have getting gradle DSL method not found error after adding lib file

app/build.gradle

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.5.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}
allprojects {
    repositories {
        jcenter()
    }
}
task clean(type: Delete) {
    delete rootProject.buildDir
}

android {
    compileSdkVersion 19
    buildToolsVersion '23.0.1'
}
dependencies {
}
apply plugin: 'checkstyle'

below are the code build.gradle code which i get error.

   apply plugin: 'com.android.library'

android {
    compileSdkVersion 17
    buildToolsVersion "19.1.0"

    defaultConfig {
        minSdkVersion 7
        targetSdkVersion 10
    }

    buildTypes {
        release {
            minifyEnabled true
            proguardFiles 'proguard-android-optimize.txt'
        }
    }
}

dependencies {
    compile files('libs/core.jar')
}

there are two build.gradle one is app and other is library.

enter image description here

Azzabi Haythem
  • 2,318
  • 7
  • 26
  • 32
Hemina
  • 375
  • 1
  • 11

1 Answers1

1

You are using the wrong build.gradle file

In your top-level file you can't use the android block:

Just remove this part from the first build.gradle

android {
    compileSdkVersion 19
    buildToolsVersion '23.0.1'
}
dependencies {

}
apply plugin: 'checkstyle'
Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841