title: How to access ext variables in Gradle
body: <p>I am trying to get the variable defined in a 3rd party library (fabric) to do a condition based on whether Crashlytics is enabled or not.</p>
  
  <pre><code>ext.enableCrashlytics = true
  </code></pre>
  
  <p><a href="http://support.crashlytics.com/knowledgebase/articles/202938-gradle" rel="noreferrer">http://support.crashlytics.com/knowledgebase/articles/202938-gradle</a>
  The variable can be configured in buildTypes or in flavors but I can't find a way to access it elsewhere in my build.gradle</p>
  
  <p>I tried several things without any luck.</p>
  
  <pre><code>allprojects.getProperties().get("enableCrashlytics")
  project.enableCrashlytics
  project.ext.enableCrashlytics
  allProjects.ext.enableCrashlytics
  </code></pre>
  
  <p>Anyone tried that before? The context I'm trying to do this is to write the fabric.properties file based on if it is enabled or not.</p>
  
  <pre><code>android.applicationVariants.all { variant -&gt;
    ...
    //create fabric.properties
    ...
  }
  </code></pre>