Gradle Dsl Method Not Found: Android()
Solution 1:
If you have an android
block in your build script, you need one of the following two statements, depending on whether your module is an application module or a library module:
apply plugin: 'com.android.application'
or:
apply plugin: 'com.android.library'
Having said that, there are other problems with your build script. For one, this is a top-level build script (as you can see by the comment that says "Top-level build file where you can add configuration options..."), so it's likely that there isn't actually a top-level module for the android
block to apply to, so adding the apply plugin
statement may just lead to a different error. If that happens, remove the android
block.
Another issue is that you already have a apply plugin: 'java'
statement in this build script. You can't use both the Java and the Android plugins in the same build script; they collide with each other.
Solution 2:
Just delete this method from your root build.gradle
android {
compileSdkVersion 21
buildToolsVersion '21.0.0'
dexOptions {
incremental true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_6
targetCompatibility JavaVersion.VERSION_1_6
} }
It should work after you compile again.
Solution 3:
if get error then check your gradle file version and remove other gradle dependancy like classpath 'com.android.tools.build:gradle:1.5.0'
it may solve the problem
Post a Comment for "Gradle Dsl Method Not Found: Android()"