title: Reading metadata from build.gradle
body: <p>According to <a href="https://developer.android.com/tools/building/configuring-gradle.html#workBuildVariants" rel="nofollow">this</a> I can create several "flavors" in my Android Studio project. But, it looks like I can only create two trees that then will be built. </p>
  
  <p>Is it possible to add variables in my <code>build.gradle</code> file, that I can then access from code, so that I can have a more fine-grained control on how my app will be built?</p>
  
  <p>E.g. in my <code>build.gradle</code>:</p>
  
  <pre><code>productFlavors {
      free {
          applicationId "com.example.app.free"
          showAds "yes"
      }
      full {
          applicationId "com.example.app.full"
          showAds "no"
      }
  }
  </code></pre>
  
  <p>and then in my code</p>
  
  <pre><code>String showAds = Gradle.getString("showAds");
  if ("yes".equals(showAds)) {
       // show ads
  }
  </code></pre>