BuildConfig.DEBUG always false when building library projects with gradle

With Android Studio 1.1 and having also the gradle version at 1.1 it is possible:

Library

android {
    publishNonDefault true
}

App

dependencies {
    releaseCompile project(path: ':library', configuration: 'release')
    debugCompile project(path: ':library', configuration: 'debug')
}

Complete documentation can be found here http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Library-Publication

EDIT:

The issue has just been marked as fixed for the Android Studio Gradle Version 3.0. There you can just use implementation project(path: ':library') and it’ll select the correct configuration automatically.

Leave a Comment