title: Build variants in Gradle for a Library Project in Android
body: <p>I am trying to configure with Gradle a project which contains some external libraries. With Gradle I can setup different Environmental Configuration (with a class inside a config file) for the main application using the Build Variants so I can execute code according to this variables. </p>
  
  <p>The problem is that how I can do the same for a library project? I created this library for this project and I would like to setup different Build Variants for different scenarios. </p>
  
  <p>As an example: 
  In the Library, when running in debug mode, then print all the logs so I can see them while developing. In release mode dont. </p>
  
  <p>Structure of the files:</p>
  
  <pre><code>src ----- &gt; debug -&gt; java -&gt; config -&gt; PlayerEnvConfig
              main -&gt; com.mypackagename -&gt; etc...
              release -&gt; java -&gt; config -&gt; PlayerEnvConfig
  </code></pre>
  
  <p>Code in debug: 
  package config;</p>
  
  <pre><code>/**
   * Environment configuration for Release
  */
  public final class PlayerEnvConfig {
      public static final boolean USE_REPORTING = true;
      public static final boolean USE_ANALYTICS = true;
      public static final boolean USE_LOGGING = false;
      public static final boolean USE_DEBUG_LOGGING = false;
      public static final boolean USE_DEBUGING = false;
  }
  </code></pre>
  
  <p>Code in release:</p>
  
  <pre><code>package config;
  
  /**
   * Environment configuration for Release
  */
  public final class PlayerEnvConfig {
      public static final boolean USE_REPORTING = true;
      public static final boolean USE_ANALYTICS = true;
      public static final boolean USE_LOGGING = false;
      public static final boolean USE_DEBUG_LOGGING = false;
      public static final boolean USE_DEBUGING = false;
  }
  </code></pre>
  
  <p>The problem is that for the main project I can use this Build types to configure differently the application for different scenarios, but how can I do the same for the Library Project? </p>
  
  <p>Because at the moment from what I read in <a href="http://tools.android.com/tech-docs/new-build-system/user-guide" rel="noreferrer">http://tools.android.com/tech-docs/new-build-system/user-guide</a> the library only will use the debug mode while testing. </p>
  
  <p>Any ideas? </p>
  
  <p>Thanks!</p>