0

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

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"

谁能知道这个问题?谢谢

4

2 回答 2

1

Gradle 错误“未找到名称为‘默认’的配置。” 表示 Gradle 正在某个位置寻找模块,但没有找到。更准确地说,它正在寻找一个build.gradle文件,但没有找到。由于错误消息是指构建文件的第 5 行,我猜是这样的:

evaluationDependsOn(':library')

所以确保有一个“library”目录,里面有一个build.gradle文件,位于项目的根目录之外。

于 2015-06-19T14:41:43.460 回答
1

您需要遵循自述文件中的所有说明,包括运行:

git submodule init
git submodule update

在你建造之前。

于 2015-06-19T14:57:24.663 回答