title: How does resConfigs work in android (gradle)?
body: <p>Lack of proper documentation on gradle method <code>resConfigs</code> made me ask this question.</p>
  <h2>Official documentation:</h2>
  <ul>
  <li>In <a href="https://developer.android.com/studio/build/shrink-code.html#unused-alt-resources" rel="noreferrer">this</a> example, google gives a specific example of how to use it
  with Languages.</li>
  <li>In <a href="https://developer.android.com/studio/build/optimize-your-build#reduce_resources" rel="noreferrer">this</a> example, google mixed Languages and
  Drawables</li>
  <li>I was unable to find any <em>javadoc</em> like gradle doc for the same</li>
  </ul>
  <hr />
  <h2>My (mostly wrong) understanding:</h2>
  <p>If I specify something in front of <code>resConfigs</code>, only that gets included in the final build, everything else does not get bundled into the apk.</p>
  <hr />
  <h2>Android app setup</h2>
  <p>The test app has</p>
  <ul>
  <li>Multiple languages (values-en , values-fr, ...)</li>
  <li>Multiple drawable folders (drawable-xxhdpi, drawable-xxxhdpi, ...)</li>
  <li>Multiple android versions (values-v21 , values-v7, ...)</li>
  <li>Multiple smallest widths(sw800, sw1000, ...)</li>
  <li>Multiple orientations (port,land)</li>
  <li>etc</li>
  </ul>
  <hr />
  <h2>My Test Observations</h2>
  <p>Note: I used android studios' apk analyzer to deduce the following results. before every test, full clean, rebuild, and prod build was generated with proguard(shrink) enabled.</p>
  <hr />
  <p><strong>Test 1:</strong>
  I specified only languages <code>resConfigs=&quot;en&quot;, &quot;fr&quot;</code></p>
  <p><strong>Result 1:</strong>
  In the apk,</p>
  <ul>
  <li>all languages vanished except en and fr</li>
  <li>all other resources were present (drawables, dimens, sw, orientation ...)</li>
  </ul>
  <hr />
  <p><strong>Test 2:</strong>
  I specified only drawables <code>resConfigs=&quot;xxhdpi&quot;</code></p>
  <p><strong>Result 2:</strong>
  In the apk,</p>
  <ul>
  <li>all languages were present</li>
  <li>all other resources were present (dimens, sw, orientation ...)</li>
  <li>all drawables vanished except xxhdpi. (all other drawable folders were present, but had 0 byte files)</li>
  </ul>
  <hr />
  <p><strong>Test 3:</strong>
  I specified languages and drawable <code>resConfigs=&quot;en&quot;,&quot;fr&quot;,&quot;xxhdpi&quot;</code></p>
  <p><strong>Result 3:</strong>
  In the apk,</p>
  <ul>
  <li>all languages vanished except en and fr</li>
  <li>all other resources were present (dimens, sw, orientation ...)</li>
  <li>all drawables vanished except xxhdpi.</li>
  </ul>
  <hr />
  <h2>Questions:</h2>
  <ol>
  <li>When I only specify languages <code>resConfigs=&quot;en&quot;, &quot;fr&quot;</code>, why are other resources getting bundled into the apk (for eg: drawables)</li>
  <li>Similary, when I only specify  <code>resConfigs=&quot;xxhdpi&quot;</code> , why languages and other resources get bundled</li>
  <li>In case of gradle is using some intelligence to figure out what to exclude and what not to exclude, does there exist a list of group of resources which fall under same category, is there any documentation on it?<br />
  For eg
  <ul>
  <li>Language is a group, if gradle finds at least one language tag, it excludes all other languages. otherwise, includes all languages?</li>
  <li>Drawable is a group, if gradle finds at least one drawable tag, it excludes all other drawables. otherwise, includes all drawables?</li>
  </ul>
  </li>
  </ol>
  <hr />
  <h2>Related Questions:</h2>
  <ol>
  <li><code>resConfigs</code> only worked for me on app level gradle only. When I tried to use it on a dependent module, it ignored it completely. How to make it work on a dependent module. (I was trying to integrate <a href="https://github.com/firebase/FirebaseUI-Android/tree/master/auth" rel="noreferrer">firebaseUI for auth</a>)</li>
  <li>is <code>resConfigs</code> in early stages of development, or is it meant only for development purposes, and not to be used in prod setups?</li>
  </ol>