Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android Android Data Persistence Introduction to Data Persistence Introduction to the Starter Kit

David Axelrod
David Axelrod
36,073 Points

Endlessly frustrating. error (3,0) Gradle DSL method not found 'android()'

read through the forum posts and have this error come up when i change the gradle file. I dont even see android() defined. I also get the error Error:(2,0) plugin with id com.android.application not found. Thanks!

here are my files


#Mon Jul 06 17:04:59 EDT 2015


apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion '21.1.2'
    defaultConfig {
        applicationId 'jasonphillipsdev.stormy'
        minSdkVersion 14
        targetSdkVersion 21
        versionCode 1
        versionName '1.0'
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    productFlavors {

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile files('libs/commons-io-2.4.jar')
    compile 'com.android.support:support-v13:21.0.3'


include ':app'

2 Answers

Marcus Pereira
Marcus Pereira
7,985 Points

Earlier this year I wrote a quick article on Medium showing how I solved this issue.


In short, Android Studio incorrectly adds the android() method in the top-level build.gradle file. Just delete the method. :)

Seth Kroger
Seth Kroger
56,412 Points

I'd guess the second error is causing the first because if android() is defined anywhere the android plugin is a good place for it. Googling the 2nd error brought up this: http://stackoverflow.com/questions/24795079/error1-0-plugin-with-id-com-android-application-not-found I'd start with checking the project's build.gradle file (not the app module's you listed) and go from there.