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! While you're at it, check out some resources Treehouse students have shared here.
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 trialDavid Axelrod
36,073 PointsEndlessly 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
gradle-wrapper.properties
#Mon Jul 06 17:04:59 EDT 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
build.gradle
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'
}
settings.gradle
include ':app'
2 Answers
Marcus Pereira
7,985 PointsEarlier 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
56,413 PointsI'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.