Configuration with name 'default' not found - Glide library

545 views Asked by At

I downloaded and opened Glide library 's source code using both Android Studio and Intellij IDEA 14. It shows the error like this:

D:\AndroidStudioProjects\glide-master\glide\build.gradle
Error:(5, 0) Configuration with name 'default' not found.

This is the content of build.gradle file

apply plugin: 'java'

evaluationDependsOn(':third_party:gif_decoder')
evaluationDependsOn(':third_party:disklrucache')
evaluationDependsOn(':library')

def getAndroidSdkDirectory() {
  project(':library').android.sdkDirectory
}

def getAndroidCompileSdkVersion() {
  project(':library').android.compileSdkVersion
}

def getInternalAndroidProjects() {
    [':third_party:gif_decoder', ':library'].collect { project(it) }
}
def getInternalJavaProjects() {
    [':third_party:disklrucache'].collect { project(it) }
}

def getAllInternalProjects() {
    getInternalAndroidProjects() + getInternalJavaProjects()
}

def getReleaseVariantAndroidProjects() {
    getAndroidLibraryVariants('release')
}

def getAndroidLibraryVariants(variantName) {
    getInternalAndroidProjects().collect { project ->
        project.android.libraryVariants.findAll { type ->
            type.buildType.name.equalsIgnoreCase(variantName)
        }
    }.sum()
}

def getSourceFilesForVariant(variantName) {
    getAndroidLibraryVariants(variantName).collect { it.javaCompile.source } +
            getInternalJavaProjects().collect { it.sourceSets.main.allJava }
}

def getAndroidJar() {
    "${getAndroidSdkDirectory()}/platforms/${getAndroidCompileSdkVersion()}/android.jar"
}

// Generate javadocs and sources containing batched documentation and sources for all internal projects.
['release', 'debug'].each { variantName ->

    task("${variantName}SourceJar", type: Jar) {
      from getSourceFilesForVariant(variantName)
    }

    def javadocTask = task("${variantName}Javadoc", type: Javadoc) {
        source = getSourceFilesForVariant(variantName)

        classpath = files(getAndroidLibraryVariants(variantName).collect {
            files(it.javaCompile.classpath.files, getAndroidJar())
        })
        classpath += getInternalJavaProjects().collect { files(it.configurations.compile) }

        options {
            links("http://docs.oracle.com/javase/7/docs/api/")
            linksOffline("http://d.android.com/reference", "${getAndroidSdkDirectory()}/docs/reference")
        }

        exclude '**/BuildConfig.java'
        exclude '**/R.java'
    } as Javadoc

    def cleanJavadocTask = task("clean${variantName.capitalize()}Javadoc", type: Delete) {
        delete javadocTask.destinationDir
    } as Task
    clean.dependsOn(cleanJavadocTask)

    def javadocJarTask = task("${variantName}JavadocJar", type: Jar) {
      from javadocTask.destinationDir
    } as Task
    javadocJarTask.dependsOn(javadocTask)
}

jar {
    from files(
            getReleaseVariantAndroidProjects().collect { variant ->
                variant.javaCompile.destinationDir
            }
    )
    exclude "**/R.class"
    exclude "**/BuildConfig.class"
    from files(getInternalJavaProjects().collect { it.sourceSets.main.output })
}

getAllInternalProjects().each { project ->
    jar.dependsOn(project.tasks.build)
}

artifacts {
    archives releaseJavadocJar {
        classifier 'javadoc'
    }
    archives releaseSourceJar {
        classifier 'sources'
    }
}

apply from: "$rootProject.projectDir/scripts/upload.gradle"

Can anyone know this problem? Thanks

2

There are 2 answers

0
Sam Judd On BEST ANSWER

You need to follow all of the instructions in the readme including running:

git submodule init
git submodule update

before you build.

0
Scott Barta On

The Gradle error "Configuration with name 'default' not found." means that Gradle is looking for a module at a certain location and not finding it. To be more precise, it's looking for a build.gradle file and not finding one. Since the error message is referring to line 5 of your build file, I'm guessing it's this:

evaluationDependsOn(':library')

So make sure there's a "library" directory with a build.gradle file inside, located off the root directory of the project.