Noorul
Noorul

Reputation: 3444

Configuration with name 'debug' not found in Android Studio

I am creating a library and I am following this link to add the library. Based on the documentation, I added the following two lines. The name of the library is calendarLib:

 debugCompile project(path: ':calendarLib', configuration: 'debug')
 releaseCompile project(path: ':calendarLib', configuration: 'release')

I get the configuration with name 'debug' not found error. I don`t know what to do. Kindly help me.

Upvotes: 0

Views: 5983

Answers (2)

Alex Bin Zhao
Alex Bin Zhao

Reputation: 406

If you have flavors in the subproject or library, you need to write the flavor with debug in camel case. For example, if you subproject has flavor 'calender' and 'calendarLite', and you want to use flavor 'calendarLite':

debugCompile project(path: ':calendarLib', configuration: 'calendarLiteDebug')
releaseCompile project(path: ':calendarLib', configuration: 'calendarLiteRelease')

Upvotes: 2

Emanuel Moecklin
Emanuel Moecklin

Reputation: 28866

You need to add this to your build file:

android {
    publishNonDefault true
}

because library projects only build the release build type as a default.

Alternatively you can add this to your defaultConfig:

defaultPublishConfig 'release'
publishNonDefault true

Make sure you also have the debug build type defined for your library project:

buildTypes {
    debug {
        debuggable true
        minifyEnabled false
    }
    release {
        debuggable false
        minifyEnabled true
        shrinkResources true
    }
}

Upvotes: 7

Related Questions