未找到名称“default”的配置 - Glide库

时间:2015-06-19 11:17:17

标签: android intellij-idea android-studio android-glide

我使用Android StudioIntellij IDEA 14下载并打开了Glide库的源代码。它显示如下错误:

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

这是build.gradle档案

的内容
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"

任何人都可以知道这个问题吗?感谢

2 个答案:

答案 0 :(得分:1)

Gradle错误“找不到配置名称'默认'。”意味着Gradle正在寻找某个位置的模块而没有找到它。更确切地说,它正在寻找 build.gradle 文件,而不是找到一个。由于错误消息是指构建文件的第5行,我猜是这样的:

evaluationDependsOn(':library')

因此,请确保其中包含 build.gradle 文件的“库”目录,该文件位于项目的根目录之外。

答案 1 :(得分:1)

您需要关注所有instructions in the readme,包括正在运行:

git submodule init
git submodule update

在你建立之前。