anuraagy
anuraagy

Reputation: 1479

Issues with Importing Volley to Android Studio

For some reason I can't import the volley plugin for android studio, I am getting the following error:

Error:(9, 0) Build script error, unsupported Gradle DSL method found: 'compile()'!

Possible causes could be:  
  - you are using Gradle version where the method is absent (<a href="open_gradle_settings">Fix Gradle settings</a>)
  - you didn't apply Gradle plugin which provides the method (<a href="apply_gradle_plugin">Apply Gradle plugin</a>)
  - or there is a mistake in a build script (<a href="goto_source">Goto source</a>)

Here is my build.gradle

// 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:0.12.2'
        compile 'com.mcxiaoke.volley:library:1.0.6'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

Upvotes: 0

Views: 724

Answers (1)

Scott Barta
Scott Barta

Reputation: 80010

This comment in the build file:

   // NOTE: Do not place your application dependencies here; they belong
   // in the individual module build.gradle files

means that you shouldn't put these dependency statements in this file. They belong in the build.gradle file that's in your module directory.

Upvotes: 1

Related Questions