title: Cannot resolve method 'getAllUserGroupByName()' of different flavor android studio
body: <p><strong>Consider I am having two product flavor in my android project named 'local' &amp; 'international'.</strong> 
  I am just giving a skeleton of my situation, so kindly ignore other mistakes.
  <strong>Consider I have already different source Set for different flavor.</strong></p>
  
  <p>Now in my 'local' flavor I just need the one method as mentioned below.</p>
  
  <pre><code>// local flavor file
  interface UserDao {
      List&lt;User&gt; getAllUser();
  }
  </code></pre>
  
  <p>While in my international flavor I also need additional feature to get the user in a group by its name also. So having two methods.</p>
  
  <pre><code>// international flavor file
  interface UserDao {
      List&lt;User&gt; getAllUser();
      List&lt;User&gt; getAllUserGroupByName();
  }
  </code></pre>
  
  <p>But the problem is,
  <strong>I am having a single activity from where I am calling that method.</strong>
  When I am calling <code>getAllUserGroupByName()</code> method from activity it will compile if
  current flavor is '<strong>international</strong>' but it will not compile on '<strong>local</strong>' flavor as it does not contain that method.</p>
  
  <p>I tried calling this method by wrapping in if condition like below,</p>
  
  <pre><code>// BuildUtils is my helper class to get current flavor check easily.
  if (BuildUtils.isInternational()) {
        getAppDatabase().UserDao().getAllUserGroupByName();
  }
  </code></pre>
  
  <p>But it's not working too.</p>
  
  <p><strong>I don't want the following solution.</strong></p>
  
  <ul>
  <li>Two activity for each flavors.</li>
  <li>I already solved it by combining both interface in a single interface. (which is also valid as it does not contain any implementation).</li>
  </ul>
  
  <p><strong>Updated</strong></p>
  
  <p>After some research and answer given by @manouti </p>
  
  <blockquote>
    <p>The issue is that Java is a statically typed language, so placing an
    if condition does not mean that the compiler will avoid checking the
    code with the getAllUserGroupByName invocation.</p>
  </blockquote>
  
  <p><strong>So is there any way that build system can ignore the particular code according to flavor for code compilation?</strong></p>
  
  <p><strong>OR</strong></p>
  
  <p><strong>any Android studio IDE tool or feature that will discard the particular code according to flavor for compilation.</strong></p>