0

I'm using android studio and i want to add an external library project to my main project from GitHub.com. I have created a folder named libs and add the whole module to it.Then like what is told in github i added this line of code to build.gradle file

compile 'org.apmem.tools:layouts:1.10@aar'

But i could not build my project and received this error

Error:(9, 1) A problem occurred evaluating root project 'MyProject'. Could not find method compile() for arguments [org.apmem.tools:layouts:1.10@aar] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

After searching about this problem find a solution here and follow steps which has described there.

But now i receive this error

Error:A problem occurred configuring project ':app'. Cannot evaluate module android-flowlayout-master : Configuration with name 'default' not found.

EDIT : my build.gradle file

buildscript {
repositories {
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:2.2.0'
    compile 'org.apmem.tools:layouts:1.10@aar'

    // 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
}
Community
  • 1
  • 1
M_Mogharrabi
  • 1,369
  • 5
  • 29
  • 57

1 Answers1

0

There are multiple build.gradle files in Android projects. There is the project level one that's in the root of your project, and then there are the module level ones, which are in the subfolders of the modules. By default, you have one module in the project, called app.

When you're adding dependencies, you have to add them to the module's build.gradle file (which has the android block on top by default), inside the dependencies block. This is what the comment in the project level build.gradle is warning you about.

By default, this file is in the app folder. It looks like this if you're using the Android view of the project in Android Studio:

enter image description here

zsmb13
  • 85,752
  • 11
  • 221
  • 226