0

你好我有这个错误的问题

Error:Configuration with name 'default' not found.

我的 build.gradle :projeck

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.2'

        // 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
}

我的 build.gradle :app

   apply plugin: 'com.android.application'

android {
    compileSdkVersion 24
    buildToolsVersion "24.0.3"
    defaultConfig {
        applicationId "com.atry.paradox.listdrop"
        minSdkVersion 15
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile project(':library2')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:24.2.1'
    testCompile 'junit:junit:4.12'
}

我的 settings.gradle

include ':app', ':library2'

我在谷歌上寻找这个错误,但我找到了将 library2 复制到主文件的建议。我在同一个文件中有库 2,我有应用程序、构建、gradle ......

请问我在哪里做错误?

谢谢

4

1 回答 1

0

这取决于settings.gradle文件:

include ':app', ':library2'

Gradle 正在寻找 2 个项目(app 和 library2)。
这些项目中的每一个都必须在其中包含该build.gradle文件。

root
|--build.gradle
|--settings.gradle
|--app
|----build.gradle
|--library2
|----build.gradle

这个错误:

   Error:Configuration with name 'default' not found.

如果一个模块(或更多)没有该build.gradle文件,就会发生这种情况。

检查您的library2文件夹是否具有build.gradle正确的结构。

于 2016-10-21T19:40:25.277 回答