Gradle DSL method not found: android ()

Any suggestions to fix this problem: I get this error in android studio after importing Project

Error: (16, 0) Gradle DSL method not found: 'android ()' Possible causes:

The LoginActivity project may use a version of Gradle that does not contain a method. Gradle Settings The build file may not include the Gradle plugin. Apply Gradle Plugin
// 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:1.1.0'
    }
}
allprojects {
    repositories {
        jcenter()
    }
}

android {
    compileSdkVersion 21
    buildToolsVersion '21.0.0'
    dexOptions {
        incremental true
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_6
        targetCompatibility JavaVersion.VERSION_1_6
    }
}
dependencies {
    compile 'com.android.support:support-v4:21.0.3'
    compile 'com.android.support:appcompat-v7:21.0.3'
}
apply plugin: 'eclipse'
apply plugin: 'java'

A notification bar appears that says: Gradle could not synchronize the project. A basic function (e.g. editing, debugging) will not work properly.

Please help me get rid of this problem. Thank!

+4
3

android script, , , :

apply plugin: 'com.android.application'

apply plugin: 'com.android.library'

, script. -, script ( , " , ..." ), , , android , apply plugin . , android.

, apply plugin: 'java' script. Java, Android- script; .

+3

build.gradle

android {
compileSdkVersion 21
buildToolsVersion '21.0.0'
dexOptions {
    incremental true
}
compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_6
    targetCompatibility JavaVersion.VERSION_1_6
} }

.

+2

if you get an error, then check the version of the gradle file and remove the other gradle dependency as classpath 'com.android.tools.build:gradle:1.5.0'it might solve the problem

0
source

All Articles