6

I am trying to install Picasso (http://square.github.io/picasso/) for use in Android Studio. One of the steps is to add this line: compile 'com.squareup.picasso:picasso:2.5.2' in build.gradle under dependencies. However, there is a message in gradle that tells me not to insert individual dependencies in the dependencies folder. What should I do?

// 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:1.3.0'

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

allprojects {
repositories {
    jcenter()
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}
felix
  • 454
  • 9
  • 19

2 Answers2

12

You need to add it to the gradle.build file that is located in the "app" directory, not the one in your project directory. find the gradle.build file that sits within the "app" directory of your project.

Here is mine as an example:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 20
    buildToolsVersion "22.0.1"

    defaultConfig {
        applicationId "com.your.packagename" 
        minSdkVersion 15
        targetSdkVersion 21
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }



}

repositories { mavenCentral() }

dependencies {
    compile 'com.android.support:appcompat-v7:18.0.+'
    compile 'com.facebook.android:facebook-android-sdk:4.0.0'
    compile 'com.parse.bolts:bolts-android:1.+'
    compile 'com.parse:parse-android:1.+'

}

And a link to some supporting documentation: http://developer.android.com/tools/building/configuring-gradle.html

JCutting8
  • 732
  • 9
  • 29
2

Screenshot of the build.gradle(Module:app file)

enter image description here

Take a look at the image. Do you see that there are actually 2 build.gradle files? what you need is the (Module:app) gradle build file select that and paste the link in the dependencies part in the bottom of that file just like what i have done , then Android Studio will ask you to sync the file. Do it. It will download the dependency from your link provided and integrate with the project
Hope this helps..

Yurets
  • 3,999
  • 17
  • 54
  • 74
Infamous
  • 744
  • 11
  • 25