title: Customize AndroidManifest in different build types
body: <p>I want to customize AndroidManifest in different build types. For example in debug mode I just want an Activity to be exported. </p>
  
  <p>Assume main manifest:</p>
  
  <pre><code>/main/AndroidManifest.xml
  
  &lt;application&gt;
      &lt;activity
          android:name="com.example.MainActivity" /&gt;
  &lt;/application&gt;
  </code></pre>
  
  <p>Debug manifest:</p>
  
  <pre><code>/debug/AndroidManifest.xml
  
  &lt;application&gt;
      &lt;activity
          android:name="com.example.MainActivity"
          android:exported="true" /&gt;
  &lt;/application&gt;
  </code></pre>
  
  <p>Example manifest (same as debug):</p>
  
  <pre><code>/example/AndroidManifest.xml
  
  &lt;application&gt;
      &lt;activity
          android:name="com.example.MainActivity"
          android:exported="true" /&gt;
  &lt;/application&gt;
  </code></pre>
  
  <p>In the debug manifest I get <code>Duplicate registration for activity com.example.MainActivity</code></p>
  
  <p>That's why I created the example build type. </p>
  
  <pre><code>/build.gradle
  
  android {
      buildTypes {
          example.initWith(buildTypes.debug)
      }
  }
  </code></pre>
  
  <p>But it also doesn't work.</p>
  
  <pre><code>[AndroidManifest.xml:17, AndroidManifest.xml:4] Trying to merge incompatible /manifest/application/activity[@name=com.example.MainActivity] element:
    &lt;activity
  --    @android:name="com.example.MainActivity"&gt;
  --&lt;/activity&gt;
  --(end reached)
    &lt;activity
  ++    @android:exported="true"
  ++    @android:name="com.example.MainActivity"&gt;
  ++&lt;/activity&gt;
  </code></pre>
  
  <p>I'm wondering whether this is a bug, missing feature (will be implemented in the future) or I'm doing something wrong?</p>
  
  <p>I know I can provide different manifest in release and debug (without the one in <code>/main</code>), but I don't think this is a good solution. </p>
  
  <p><strong>EDIT:</strong>
  The solution so far is to define bool in resources and use it inside main manifest.
  In debug resources the bool will be <code>true</code> while in the release <code>false</code>. This solution seems much better than duplicated manifests, but the question is still actual.</p>