Isuru
Isuru

Reputation: 31323

Gradle syncing keeps failing

I'm trying to include Android Asynchronous Http Client and Picasso into my Android project using Gradle. Here's my build.gradle file.

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.9.+'
    }
}

allprojects {
    repositories {
        mavenCentral()
    }
    dependencies {
        compile 'com.loopj.android:android-async-http:1.4.4'
        compile 'com.squareup.picasso:picasso:2.1.1'
    }
}

When I try to sync it, I keep getting the following error.

No signature of method: org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.compile() is applicable for argument types: (java.lang.String) values: [com.loopj.android:android-async-http:1.4.4] Possible solutions: module(java.lang.Object)

I'm very new to Android so I'm clueless on how to correct this. Can anyone please help me out? I'm using Android Studio version 0.5.8 by the way.

Thank you.

Upvotes: 0

Views: 289

Answers (1)

Scott Barta
Scott Barta

Reputation: 80020

Don't include dependencies in your top-level build file. Include them in module-level build files instead. If you use the Project Structure UI instead of modifying build files directly, it will set things up properly.

Upvotes: 1

Related Questions