My buildDebug
dependency was also getting ignored. My setup is the app module and a library module, and I have the need to propagate the build type from the app to the library modules, i.e., when I compile the debug type on the app I want to get the library debug type too.
As mentioned, I tried having a specific dependency for each build type on the app gradle
file, but to no avail:
buildTypes {
debug {
debuggable true
applicationIdSuffix ".debug"
dependencies {
debugCompile project(":library")
}
}
}
Ultimately what did the trick for me was this: http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Library-Publication
So, now the library dependency is managed (as usual) in the global dependencies scope in the app gradle
file:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
releaseCompile project(path: ':library', configuration: 'release')
debugCompile project(path: ':library', configuration: 'debug')
}
and had to add this to the library's gradle build file:
android {
publishNonDefault true
}
This publishes all of the dependencies' build types. Note that if it takes a lot of time to compile your dependency, this solution might not be right for you.
releaseCompile project(':myLib:releaseVersion')
anddebugCompile project(':myLib:debugVersion')
, but Android Studio says:Build script error, unsupported Gradle DSL method found: 'debugCompile()'! Possible causes could be: - you are using Gradle version where the method is absent - you didn't apply Gradle plugin which provides the method - or there is a mistake in a build script
– Shearer