title: Gradle : how to use BuildConfig in an android-library with a flag that gets set in an app
body: <p>My (gradle 1.10 and gradle plugin 0.8)-based android project consists of a big android-library that is a dependency for 3 different android-apps</p>
  
  <p>In my library, I would love to be able to use a structure like this</p>
  
  <pre class="lang-java prettyprint-override"><code>if (BuildConfig.SOME_FLAG) {
      callToBigLibraries()
  }
  </code></pre>
  
  <p>as proguard would be able to reduce the size of the produced apk, based on the final value of SOME_FLAG</p>
  
  <p>But I can't figure how to do it with gradle as : </p>
  
  <pre><code>* the BuildConfig produced by the library doesn't have the same package name than the app
  * I have to import the BuildConfig with the library package in the library
  * The apk of an apps includes the BuildConfig with the package of the app but not the one with the package of the library.
  </code></pre>
  
  <p>I tried without success to play with BuildTypes and stuff like </p>
  
  <pre class="lang-java prettyprint-override"><code>release {
      // packageNameSuffix "library"
      buildConfigField "boolean", "SOME_FLAG", "true"
  }
  debug {
      //packageNameSuffix "library"
      buildConfigField "boolean", "SOME_FLAG", "true"
  }
  </code></pre>
  
  <p>What is the right way to builds a shared BuildConfig for my library and my apps whose flags will be overridden at build in the apps?</p>