Search code examples
androidgradleandroid-studioandroid-gradle-pluginbuild-error

Reference a library project without copying on Android Studio - Error:Configuration with name 'default' not found


I'm trying to migrate my Android projects from Eclipse to Android Studio. I have a library project which is used in other projects and that's the reason I want it to be separated (not copied in the project). To do this I followed this answer. But I get the following error:

Error:Configuration with name 'default' not found.

I read and tried all the answers on Internet for this error but nothing fixed my problem.

settings.gradle

include ':my_android_app'
include ':my_android_project_lib'
project(':my_android_project_lib').projectDir = new File(settingsDir, '../my_android_project_lib')

build.gradle for my_android_app module

apply plugin: 'com.android.application'

android {
    compileSdkVersion 19
    buildToolsVersion "21.1.2"

    defaultConfig {
        applicationId "my.android.app"
        minSdkVersion 15
        targetSdkVersion 19
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile project(path: ':my_android_project_lib')
}

build.gradle for my_android_app project

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

allprojects {
    repositories {
        jcenter()
    }
}

Edit: This answer helped me to fix the problem. I had to add the dependencies to the project's build.gradle file.


Solution

  • Could you comple with "gradles tasks --info" and see what you've got ?

    Otherwise, here you might have something helpfull.

    Cheers !