title: How to use final resolved applicationId in build.gradle
body: <p>Say I have the following build.gradle</p>
  
  <pre><code>android{
      defaultConfig{
          applicationId "com.example.base"
      }
      buildTypes{
          release{
              minifyEnabled true
          }
          debug{
              applicationIdSuffix ".dev"
              minifyEnabled false
          }
      }
      productFlavors{
          free{
              applicationId "com.example.free"
          }
          paid{
              applicationId "com.example.paid"
          }
      }
  }
  </code></pre>
  
  <p>I want to add the resulting application id to strings.xml, like this:</p>
  
  <pre><code>resValue "string", "app_package", applicationId
  </code></pre>
  
  <p>So I can then use this value in intents <code>targetPackage</code> defined in preferences xml</p>
  
  <p>But the value changes depending on what block I put that line in:</p>
  
  <ul>
  <li>defaultConfig -> "com.example.base" (always the base Id, useless)</li>
  <li>productFlavours.free -> "com.example.free" (problem is this <strong>does not change</strong> to "com.example.free.dev" for debug builds)</li>
  <li>productFlavours -> Error, does not build</li>
  <li>buildTypes.debug -> Error, does not build</li>
  </ul>
  
  <p>By using the applicationIdSuffix, I need gradle to resolve the final id before I can use it. How do I do that?</p>