title: Android build will not merge manifests from libraries
body: <p>We have multiple projects, depending on a many Android lib modules.
  To avoid duplicated xml tags in the apps manifests, we put the relevant receivers, services and activities in their respective modules.</p>
  
  <p>Till today, we used:</p>
  
  <ul>
  <li>Android Studio: 2.2.1</li>
  <li>gradle: 2.1.3</li>
  <li>buildToolsVersion: 23.0.3</li>
  </ul>
  
  <p>Today we've updated to:</p>
  
  <ul>
  <li>Android Studio: 2.3</li>
  <li>gradle: 2.3.0</li>
  <li>buildToolsVersion: 25.0.0</li>
  </ul>
  
  <p>Up until this update, everything worked just fine and the manifests were merged, we had conflicts and we fixed them. As of the update we've done, the manifests will not merge, at all!!</p>
  
  <p>--- Update 1 ---</p>
  
  <p>We've used the Merged Manifest view, and saw that it just doesn't include the manifests in the merge, the only thing it does merge from the modules manifest is the permissions, so for example, if I add a new permission to a modules manifest it would ONLY merge it and not the rest of the elements!</p>
  
  <p><a href="https://i.stack.imgur.com/GKLCy.png" rel="noreferrer"><img src="https://i.stack.imgur.com/GKLCy.png" alt="Nothing to merge"></a></p>
  
  <p>I guarantee there are a lot of stuff to merge!</p>
  
  <p>--- Update 2 --- </p>
  
  <p>It seems that everything <strong>outside</strong> the application tag it merges into the main manifest, and everything <strong>within</strong> the application tag, it doesn't.</p>
  
  <p>--- Update 3 ---</p>
  
  <p><strong>Module that doesn't merge:</strong></p>
  
  <p>Gradle:</p>
  
  <pre><code>apply plugin: 'com.android.library'
  
  android {
      compileSdkVersion 23
      buildToolsVersion '25.0.0'
  
      defaultConfig {
          minSdkVersion 16
          targetSdkVersion 23
          versionCode 1
          versionName "1.0"
      }
      buildTypes {
          release {
              minifyEnabled false
              proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
          }
          debug {
              jniDebuggable true
          }
      }
  }
  
  dependencies {
      compile project(path: ':android-infra')
      compile 'com.google.android.gms:play-services-gcm:9.0.0'
      compile project(path: ':engine-core-server')
      compile project(path: ':engine-core-aneeda')
  }
  </code></pre>
  
  <p>Manifest: </p>
  
  <pre><code>&lt;manifest package="com.sensiya.voip.managers.gcm"
            xmlns:android="http://schemas.android.com/apk/res/android"
            xmlns:tools="http://schemas.android.com/tools"&gt;
  
      &lt;uses-permission android:name="com.google.android.c2dm.permission.KAKI"/&gt;
  
  
      &lt;application
          tools:node="replace"&gt;
          &lt;service
              android:enabled="true"
            android:name="com.sensiya.voip.managers.gcm.GcmIntentService"/&gt;
  
          &lt;receiver          android:name="com.sensiya.voip.managers.gcm.GcmBroadcastReceiver"
              android:permission="com.google.android.c2dm.permission.SEND"&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="com.google.android.c2dm.intent.RECEIVE"/&gt;
  
                  &lt;category android:name="com.iamplus.onenumber.device"/&gt;
              &lt;/intent-filter&gt;
          &lt;/receiver&gt;
      &lt;/application&gt;
  &lt;/manifest&gt;
  </code></pre>
  
  <p><strong>Module that will merge:</strong></p>
  
  <p>Gradle:</p>
  
  <pre><code>apply plugin: 'com.android.library'
  
  android {
      compileSdkVersion 23
      buildToolsVersion '25.0.0'
  
      defaultConfig {
          minSdkVersion 16
          targetSdkVersion 23
          versionCode 1
          versionName "1.0"
      }
  
      buildTypes {
          release {
              minifyEnabled false
              proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
          }
          debug {
              jniDebuggable true
          }
      }
  }
  
  dependencies {
      compile project(path: ':android-infra')
      compile 'com.sensiya:sense-services-client:1.24.2@aar'
      compile project(path: ':engine-core-server')
      compile project(path: ':engine-core-aneeda')
  }
  </code></pre>
  
  <p>Manifest:</p>
  
  <pre><code>&lt;manifest package="com.iamplus.android.senseServices"
            xmlns:android="http://schemas.android.com/apk/res/android"
            xmlns:tools="http://schemas.android.com/tools"&gt;
  
      &lt;application
          tools:node="replace"&gt;
          &lt;service
              android:name="com.iamplus.senseServices.ContextualEventService"
              android:enabled="true"/&gt;
  
          &lt;service
              android:name="com.iamplus.senseServices.Serv"
              android:enabled="true"/&gt;
  
          &lt;service
              android:name="com.iamplus.senseServices.Serv1"
              android:enabled="true"/&gt;
      &lt;/application&gt;    
  &lt;/manifest&gt;
  </code></pre>
  
  <p>Any suggestions?</p>