Skip to content Skip to sidebar Skip to footer

Gradle Sync Error:configuration With Name 'default' Not Found

I want to add an external library GuillotineMenu-Android in my application. I followed the steps given in the most upvoted answer to an existing question How do I add a library pro

Solution 1:

You should have a structure like this:

projectRoot
  app
     build.gradle
  library
     build.gradle
  build.gradle
  settings.gradle

Each module has own build.gradle file. Also the root/settings.gradle defines all modules inside a project. Don't use another settings.gradle inside your module.

In settings.gradle :

include':app', ':library'

In build.gradle

    buildscript {
        repositories {
            jcenter()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:1.2.3'// NOTE: Do not place your application dependencies here; they belong// in the individual module build.gradle files
        }
    }
    allprojects {
        repositories {
            jcenter()
        }
    }

In library/build.gradle

apply plugin: 'com.android.library'

android {
    compileSdkVersion ...
    buildToolsVersion ...

    defaultConfig {
        ....
    }

}

dependencies {
   //....
}

In app/build.gradle use your file but change:

dependencies {
    //...// GuillotineMenu
    compile project(":library")
}

UPDATE:

After your comment below, I think that in your case the library folder is the root folder of another project. It means that you should refer to the module inside this project.

    projectRoot
      app
         build.gradle
      libs
         guillotinemenu
           build.gradle //top level file of guillotinemenu project
    -->>   module       
              build.gradle  //build.gradle of the module

So change the settings.gradle of your projectRoot.

include':app', ':guillotinemenu'
 project(':guillotinemenu').projectDir = new File('libs/guillotinemenu/module')

The module (libs/guillotinemenu/module) should have a build.gradle as the library/build.gradle described above.

Post a Comment for "Gradle Sync Error:configuration With Name 'default' Not Found"